From ad072a0cc18a74079df7788512f59898f4e50165 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar <78945437+ujjwal-ibm@users.noreply.github.com> Date: Wed, 20 Dec 2023 16:47:01 +0530 Subject: [PATCH] feat(spec): updated the sdk as per the api spec released on 2023-12-20 (#86) Signed-off-by: Ujjwal Kumar --- README.md | 8 +- common/version.go | 2 +- vpcv1/vpc_v1.go | 17359 ++++++++++++++++---- vpcv1/vpc_v1_test.go | 35456 ++++++++++++++++++++++++----------------- 4 files changed, 35635 insertions(+), 17190 deletions(-) diff --git a/README.md b/README.md index 2d0e560..bd21517 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.46.0 +# IBM Cloud VPC Go SDK Version 0.47.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.46.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.47.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.46.0 +go get github.com/IBM/vpc-go-sdk@v0.47.0 ``` @@ -90,7 +90,7 @@ to your `Gopkg.toml` file. Here is an example: ``` [[constraint]] name = "github.com/IBM/vpc-go-sdk/" - version = "0.46.0" + version = "0.47.0" ``` Then run `dep ensure`. diff --git a/common/version.go b/common/version.go index 7d9c278..da1c9f4 100644 --- a/common/version.go +++ b/common/version.go @@ -1,4 +1,4 @@ package common // Version of the SDK -const Version = "0.46.0" +const Version = "0.47.0" diff --git a/vpcv1/vpc_v1.go b/vpcv1/vpc_v1.go index b808fdd..ad1d930 100644 --- a/vpcv1/vpc_v1.go +++ b/vpcv1/vpc_v1.go @@ -38,7 +38,7 @@ import ( // VpcV1 : The IBM Cloud Virtual Private Cloud (VPC) API can be used to programmatically provision and manage virtual // server instances, along with subnets, volumes, load balancers, and more. // -// API Version: 2023-12-13 +// API Version: 2023-12-20 type VpcV1 struct { Service *core.BaseService @@ -47,7 +47,7 @@ type VpcV1 struct { generation *int64 // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2023-12-05` - // and `2023-12-13`. + // and `2023-12-20`. Version *string } @@ -64,7 +64,7 @@ type VpcV1Options struct { Authenticator core.Authenticator // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2023-12-05` - // and `2023-12-13`. + // and `2023-12-20`. Version *string } @@ -122,7 +122,7 @@ func NewVpcV1(options *VpcV1Options) (service *VpcV1, err error) { } if options.Version == nil { - options.Version = core.StringPtr("2023-12-12") + options.Version = core.StringPtr("2023-12-19") } service = &VpcV1{ @@ -1583,6 +1583,9 @@ func (vpc *VpcV1) CreateVPCRouteWithContext(ctx context.Context, createVPCRouteO if createVPCRouteOptions.Action != nil { body["action"] = createVPCRouteOptions.Action } + if createVPCRouteOptions.Advertise != nil { + body["advertise"] = createVPCRouteOptions.Advertise + } if createVPCRouteOptions.Name != nil { body["name"] = createVPCRouteOptions.Name } @@ -1937,6 +1940,9 @@ func (vpc *VpcV1) CreateVPCRoutingTableWithContext(ctx context.Context, createVP if createVPCRoutingTableOptions.AcceptRoutesFrom != nil { body["accept_routes_from"] = createVPCRoutingTableOptions.AcceptRoutesFrom } + if createVPCRoutingTableOptions.AdvertiseRoutesTo != nil { + body["advertise_routes_to"] = createVPCRoutingTableOptions.AdvertiseRoutesTo + } if createVPCRoutingTableOptions.Name != nil { body["name"] = createVPCRoutingTableOptions.Name } @@ -2304,6 +2310,9 @@ func (vpc *VpcV1) CreateVPCRoutingTableRouteWithContext(ctx context.Context, cre if createVPCRoutingTableRouteOptions.Action != nil { body["action"] = createVPCRoutingTableRouteOptions.Action } + if createVPCRoutingTableRouteOptions.Advertise != nil { + body["advertise"] = createVPCRoutingTableRouteOptions.Advertise + } if createVPCRoutingTableRouteOptions.Name != nil { body["name"] = createVPCRoutingTableRouteOptions.Name } @@ -2683,10 +2692,10 @@ func (vpc *VpcV1) CreateSubnetWithContext(ctx context.Context, createSubnetOptio // DeleteSubnet : Delete a subnet // This request deletes a subnet. This operation cannot be reversed. For this request to succeed, the subnet must not be -// referenced by any bare metal server network interfaces, instance network interfaces, VPN gateways, or load balancers. -// A delete operation automatically detaches the subnet from any network ACLs, public gateways, or endpoint gateways. -// All flow log collectors with `auto_delete` set to `true` targeting the subnet or any resource in the subnet are -// automatically deleted. +// referenced by any bare metal server network interfaces, instance network interfaces, virtual network interfaces, VPN +// gateways, or load balancers. A delete operation automatically detaches the subnet from any network ACLs, public +// gateways, or endpoint gateways. All flow log collectors with `auto_delete` set to `true` targeting the subnet or any +// resource in the subnet are automatically deleted. func (vpc *VpcV1) DeleteSubnet(deleteSubnetOptions *DeleteSubnetOptions) (response *core.DetailedResponse, err error) { return vpc.DeleteSubnetWithContext(context.Background(), deleteSubnetOptions) } @@ -3371,6 +3380,18 @@ func (vpc *VpcV1) ListSubnetReservedIpsWithContext(ctx context.Context, listSubn if listSubnetReservedIpsOptions.Sort != nil { builder.AddQuery("sort", fmt.Sprint(*listSubnetReservedIpsOptions.Sort)) } + if listSubnetReservedIpsOptions.TargetID != nil { + builder.AddQuery("target.id", fmt.Sprint(*listSubnetReservedIpsOptions.TargetID)) + } + if listSubnetReservedIpsOptions.TargetCRN != nil { + builder.AddQuery("target.crn", fmt.Sprint(*listSubnetReservedIpsOptions.TargetCRN)) + } + if listSubnetReservedIpsOptions.TargetName != nil { + builder.AddQuery("target.name", fmt.Sprint(*listSubnetReservedIpsOptions.TargetName)) + } + if listSubnetReservedIpsOptions.TargetResourceType != nil { + builder.AddQuery("target.resource_type", fmt.Sprint(*listSubnetReservedIpsOptions.TargetResourceType)) + } request, err := builder.Build() if err != nil { @@ -3480,8 +3501,8 @@ func (vpc *VpcV1) CreateSubnetReservedIPWithContext(ctx context.Context, createS // This request releases a reserved IP. This operation cannot be reversed. // // For this request to succeed, the reserved IP must not be required by another resource, such as a bare metal server -// network interface or instance network interface for which it is the primary IP. A provider-owned reserved IP is not -// allowed to be deleted. +// network interface, instance network interface or virtual network interface for which it is the primary IP. A +// provider-owned reserved IP is not allowed to be deleted. func (vpc *VpcV1) DeleteSubnetReservedIP(deleteSubnetReservedIPOptions *DeleteSubnetReservedIPOptions) (response *core.DetailedResponse, err error) { return vpc.DeleteSubnetReservedIPWithContext(context.Background(), deleteSubnetReservedIPOptions) } @@ -5505,8 +5526,10 @@ func (vpc *VpcV1) CreateInstanceWithContext(ctx context.Context, createInstanceO // DeleteInstance : Delete an instance // This request deletes an instance. This operation cannot be reversed. Any floating IPs associated with instance -// network interfaces are implicitly disassociated. All flow log collectors with `auto_delete` set to `true` targeting -// the instance and/or the instance network interfaces are automatically deleted. +// network interfaces are implicitly disassociated. All virtual network interfaces with `auto_delete` set to `true` +// targeting instance network attachments on the instance are automatically deleted. All flow log collectors with +// `auto_delete` set to `true` targeting the instance, the instance network attachments, the instance network +// interfaces, or the automatically deleted virtual network interfaces are automatically deleted. func (vpc *VpcV1) DeleteInstance(deleteInstanceOptions *DeleteInstanceOptions) (response *core.DetailedResponse, err error) { return vpc.DeleteInstanceWithContext(context.Background(), deleteInstanceOptions) } @@ -6108,11 +6131,352 @@ func (vpc *VpcV1) UpdateInstanceDiskWithContext(ctx context.Context, updateInsta return } +// ListInstanceNetworkAttachments : List all network attachments on an instance +// This request lists all network attachments on an instance. A network attachment represents a device on the instance +// to which a virtual network interface is attached. +// +// The network attachments will be sorted by their `created_at` property values, with newest network attachments first. +// Network attachments with identical `created_at` property values will in turn be sorted by ascending `name` property +// values. +func (vpc *VpcV1) ListInstanceNetworkAttachments(listInstanceNetworkAttachmentsOptions *ListInstanceNetworkAttachmentsOptions) (result *InstanceNetworkAttachmentCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceNetworkAttachmentsWithContext(context.Background(), listInstanceNetworkAttachmentsOptions) +} + +// ListInstanceNetworkAttachmentsWithContext is an alternate form of the ListInstanceNetworkAttachments method which supports a Context parameter +func (vpc *VpcV1) ListInstanceNetworkAttachmentsWithContext(ctx context.Context, listInstanceNetworkAttachmentsOptions *ListInstanceNetworkAttachmentsOptions) (result *InstanceNetworkAttachmentCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceNetworkAttachmentsOptions, "listInstanceNetworkAttachmentsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listInstanceNetworkAttachmentsOptions, "listInstanceNetworkAttachmentsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *listInstanceNetworkAttachmentsOptions.InstanceID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceNetworkAttachmentsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkAttachments") + 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, UnmarshalInstanceNetworkAttachmentCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateInstanceNetworkAttachment : Create a network attachment on an instance +// This request creates a new instance network attachment from an instance network attachment prototype object. The +// prototype object is structured in the same way as a retrieved instance network attachment, and contains the +// information necessary to create the new instance network attachment. +func (vpc *VpcV1) CreateInstanceNetworkAttachment(createInstanceNetworkAttachmentOptions *CreateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceNetworkAttachmentWithContext(context.Background(), createInstanceNetworkAttachmentOptions) +} + +// CreateInstanceNetworkAttachmentWithContext is an alternate form of the CreateInstanceNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceNetworkAttachmentWithContext(ctx context.Context, createInstanceNetworkAttachmentOptions *CreateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceNetworkAttachmentOptions, "createInstanceNetworkAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceNetworkAttachmentOptions, "createInstanceNetworkAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *createInstanceNetworkAttachmentOptions.InstanceID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createInstanceNetworkAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceNetworkAttachment") + 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 createInstanceNetworkAttachmentOptions.VirtualNetworkInterface != nil { + body["virtual_network_interface"] = createInstanceNetworkAttachmentOptions.VirtualNetworkInterface + } + if createInstanceNetworkAttachmentOptions.Name != nil { + body["name"] = createInstanceNetworkAttachmentOptions.Name + } + _, err = builder.SetBodyContentJSON(body) + 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, UnmarshalInstanceNetworkAttachment) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteInstanceNetworkAttachment : Delete an instance network attachment +// This request deletes an instance network attachment. This operation cannot be reversed. Any floating IPs associated +// with the instance network attachment are implicitly disassociated. All flow log collectors with `auto_delete` set to +// `true` targeting the instance network attachment are automatically deleted. The primary instance network attachment +// is not allowed to be deleted. +func (vpc *VpcV1) DeleteInstanceNetworkAttachment(deleteInstanceNetworkAttachmentOptions *DeleteInstanceNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceNetworkAttachmentWithContext(context.Background(), deleteInstanceNetworkAttachmentOptions) +} + +// DeleteInstanceNetworkAttachmentWithContext is an alternate form of the DeleteInstanceNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceNetworkAttachmentWithContext(ctx context.Context, deleteInstanceNetworkAttachmentOptions *DeleteInstanceNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceNetworkAttachmentOptions, "deleteInstanceNetworkAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceNetworkAttachmentOptions, "deleteInstanceNetworkAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *deleteInstanceNetworkAttachmentOptions.InstanceID, + "id": *deleteInstanceNetworkAttachmentOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceNetworkAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceNetworkAttachment") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetInstanceNetworkAttachment : Retrieve an instance network attachment +// This request retrieves a single instance network attachment specified by the identifier in the URL. +func (vpc *VpcV1) GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptions *GetInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { + return vpc.GetInstanceNetworkAttachmentWithContext(context.Background(), getInstanceNetworkAttachmentOptions) +} + +// GetInstanceNetworkAttachmentWithContext is an alternate form of the GetInstanceNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) GetInstanceNetworkAttachmentWithContext(ctx context.Context, getInstanceNetworkAttachmentOptions *GetInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceNetworkAttachmentOptions, "getInstanceNetworkAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceNetworkAttachmentOptions, "getInstanceNetworkAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *getInstanceNetworkAttachmentOptions.InstanceID, + "id": *getInstanceNetworkAttachmentOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceNetworkAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkAttachment") + 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, UnmarshalInstanceNetworkAttachment) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateInstanceNetworkAttachment : Update an instance network attachment +// This request updates an instance network attachment with the information provided in an instance network interface +// patch object. The instance network attachment patch object is structured in the same way as a retrieved instance +// network attachment and needs to contain only the information to be updated. +func (vpc *VpcV1) UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptions *UpdateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceNetworkAttachmentWithContext(context.Background(), updateInstanceNetworkAttachmentOptions) +} + +// UpdateInstanceNetworkAttachmentWithContext is an alternate form of the UpdateInstanceNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceNetworkAttachmentWithContext(ctx context.Context, updateInstanceNetworkAttachmentOptions *UpdateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceNetworkAttachmentOptions, "updateInstanceNetworkAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateInstanceNetworkAttachmentOptions, "updateInstanceNetworkAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *updateInstanceNetworkAttachmentOptions.InstanceID, + "id": *updateInstanceNetworkAttachmentOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateInstanceNetworkAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceNetworkAttachment") + 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(updateInstanceNetworkAttachmentOptions.InstanceNetworkAttachmentPatch) + 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, UnmarshalInstanceNetworkAttachment) + if err != nil { + return + } + response.Result = result + } + + return +} + // ListInstanceNetworkInterfaces : List all network interfaces on an instance // This request lists all network interfaces on an instance. An instance network interface is an abstract representation // of a network device and attaches an instance to a single subnet. Each network interface on an instance can attach to // any subnet in the zone, including subnets that are already attached to the instance. Multiple network interfaces on // the instance may also attach to the same subnet. +// +// If this instance has network attachments, each returned network interface is a [read-only +// representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network attachment and +// its attached virtual network interface. func (vpc *VpcV1) ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions) (result *NetworkInterfaceUnpaginatedCollection, response *core.DetailedResponse, err error) { return vpc.ListInstanceNetworkInterfacesWithContext(context.Background(), listInstanceNetworkInterfacesOptions) } @@ -6179,6 +6543,10 @@ func (vpc *VpcV1) ListInstanceNetworkInterfacesWithContext(ctx context.Context, // prototype object is structured in the same way as a retrieved instance network interface, and contains the // information necessary to create the new instance network interface. Any subnet in the instance's VPC may be // specified. Addresses on the instance network interface must be within the specified subnet's CIDR blocks. +// +// If this instance has network attachments, each network interface is a [read-only +// representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network attachment and +// its attached virtual network interface, and new network interfaces are not allowed to be created. func (vpc *VpcV1) CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { return vpc.CreateInstanceNetworkInterfaceWithContext(context.Background(), createInstanceNetworkInterfaceOptions) } @@ -6267,6 +6635,10 @@ func (vpc *VpcV1) CreateInstanceNetworkInterfaceWithContext(ctx context.Context, // with the instance network interface are implicitly disassociated. All flow log collectors with `auto_delete` set to // `true` targeting the instance network interface are automatically deleted. The primary instance network interface is // not allowed to be deleted. +// +// If this instance has network attachments, this network interface is a [read-only +// representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network attachment and +// its attached virtual network interface, and is not allowed to be deleted. func (vpc *VpcV1) DeleteInstanceNetworkInterface(deleteInstanceNetworkInterfaceOptions *DeleteInstanceNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { return vpc.DeleteInstanceNetworkInterfaceWithContext(context.Background(), deleteInstanceNetworkInterfaceOptions) } @@ -6319,6 +6691,10 @@ func (vpc *VpcV1) DeleteInstanceNetworkInterfaceWithContext(ctx context.Context, // GetInstanceNetworkInterface : Retrieve an instance network interface // This request retrieves a single instance network interface specified by the identifier in the URL. +// +// If this instance has network attachments, the retrieved network interface is a +// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network +// attachment and its attached virtual network interface. func (vpc *VpcV1) GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { return vpc.GetInstanceNetworkInterfaceWithContext(context.Background(), getInstanceNetworkInterfaceOptions) } @@ -6385,6 +6761,10 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceWithContext(ctx context.Context, ge // This request updates an instance network interface with the information provided in an instance network interface // patch object. The instance network interface patch object is structured in the same way as a retrieved instance // network interface and needs to contain only the information to be updated. +// +// If this instance has network attachments, this network interface is a [read-only +// representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network attachment and +// its attached virtual network interface, and is not allowed to be updated. func (vpc *VpcV1) UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { return vpc.UpdateInstanceNetworkInterfaceWithContext(context.Background(), updateInstanceNetworkInterfaceOptions) } @@ -11275,38 +11655,7 @@ func (vpc *VpcV1) CreateBareMetalServerWithContext(ctx context.Context, createBa builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - body := make(map[string]interface{}) - if createBareMetalServerOptions.Initialization != nil { - body["initialization"] = createBareMetalServerOptions.Initialization - } - if createBareMetalServerOptions.PrimaryNetworkInterface != nil { - body["primary_network_interface"] = createBareMetalServerOptions.PrimaryNetworkInterface - } - if createBareMetalServerOptions.Profile != nil { - body["profile"] = createBareMetalServerOptions.Profile - } - if createBareMetalServerOptions.Zone != nil { - body["zone"] = createBareMetalServerOptions.Zone - } - if createBareMetalServerOptions.EnableSecureBoot != nil { - body["enable_secure_boot"] = createBareMetalServerOptions.EnableSecureBoot - } - if createBareMetalServerOptions.Name != nil { - body["name"] = createBareMetalServerOptions.Name - } - if createBareMetalServerOptions.NetworkInterfaces != nil { - body["network_interfaces"] = createBareMetalServerOptions.NetworkInterfaces - } - if createBareMetalServerOptions.ResourceGroup != nil { - body["resource_group"] = createBareMetalServerOptions.ResourceGroup - } - if createBareMetalServerOptions.TrustedPlatformModule != nil { - body["trusted_platform_module"] = createBareMetalServerOptions.TrustedPlatformModule - } - if createBareMetalServerOptions.VPC != nil { - body["vpc"] = createBareMetalServerOptions.VPC - } - _, err = builder.SetBodyContentJSON(body) + _, err = builder.SetBodyContentJSON(createBareMetalServerOptions.BareMetalServerPrototype) if err != nil { return } @@ -11610,11 +11959,353 @@ func (vpc *VpcV1) UpdateBareMetalServerDiskWithContext(ctx context.Context, upda return } +// ListBareMetalServerNetworkAttachments : List all network attachments on a bare metal server +// This request lists all network attachments on a bare metal server. A bare metal server network attachment is an +// abstract representation of a network device and attaches a bare metal server to a single subnet. Each network +// interface on a bare metal server can attach to any subnet in the zone, including subnets that are already attached to +// the bare metal server. +// +// The network attachments will be sorted by their `created_at` property values, with newest network attachments first. +// Network attachments with identical `created_at` property values will in turn be sorted by ascending `name` property +// values. +func (vpc *VpcV1) ListBareMetalServerNetworkAttachments(listBareMetalServerNetworkAttachmentsOptions *ListBareMetalServerNetworkAttachmentsOptions) (result *BareMetalServerNetworkAttachmentCollection, response *core.DetailedResponse, err error) { + return vpc.ListBareMetalServerNetworkAttachmentsWithContext(context.Background(), listBareMetalServerNetworkAttachmentsOptions) +} + +// ListBareMetalServerNetworkAttachmentsWithContext is an alternate form of the ListBareMetalServerNetworkAttachments method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServerNetworkAttachmentsWithContext(ctx context.Context, listBareMetalServerNetworkAttachmentsOptions *ListBareMetalServerNetworkAttachmentsOptions) (result *BareMetalServerNetworkAttachmentCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBareMetalServerNetworkAttachmentsOptions, "listBareMetalServerNetworkAttachmentsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listBareMetalServerNetworkAttachmentsOptions, "listBareMetalServerNetworkAttachmentsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *listBareMetalServerNetworkAttachmentsOptions.BareMetalServerID, + } + + 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_attachments`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listBareMetalServerNetworkAttachmentsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkAttachments") + 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 listBareMetalServerNetworkAttachmentsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBareMetalServerNetworkAttachmentsOptions.Start)) + } + if listBareMetalServerNetworkAttachmentsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerNetworkAttachmentsOptions.Limit)) + } + + 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, UnmarshalBareMetalServerNetworkAttachmentCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateBareMetalServerNetworkAttachment : Create a network attachment on a bare metal server +// This request creates a new bare metal server network attachment from a bare metal server network attachment prototype +// object. The prototype object is structured in the same way as a retrieved bare metal server network attachment, and +// contains the information necessary to create the new bare metal server network attachment. +func (vpc *VpcV1) CreateBareMetalServerNetworkAttachment(createBareMetalServerNetworkAttachmentOptions *CreateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + return vpc.CreateBareMetalServerNetworkAttachmentWithContext(context.Background(), createBareMetalServerNetworkAttachmentOptions) +} + +// CreateBareMetalServerNetworkAttachmentWithContext is an alternate form of the CreateBareMetalServerNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) CreateBareMetalServerNetworkAttachmentWithContext(ctx context.Context, createBareMetalServerNetworkAttachmentOptions *CreateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createBareMetalServerNetworkAttachmentOptions, "createBareMetalServerNetworkAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createBareMetalServerNetworkAttachmentOptions, "createBareMetalServerNetworkAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *createBareMetalServerNetworkAttachmentOptions.BareMetalServerID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createBareMetalServerNetworkAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerNetworkAttachment") + 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)) + + _, err = builder.SetBodyContentJSON(createBareMetalServerNetworkAttachmentOptions.BareMetalServerNetworkAttachmentPrototype) + 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, UnmarshalBareMetalServerNetworkAttachment) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteBareMetalServerNetworkAttachment : Delete a bare metal server network attachment +// This request deletes a bare metal server network attachment. This operation cannot be reversed. Any floating IPs +// associated with the bare metal server network attachment are implicitly disassociated. +// +// The bare metal server's primary network attachment cannot be deleted. +func (vpc *VpcV1) DeleteBareMetalServerNetworkAttachment(deleteBareMetalServerNetworkAttachmentOptions *DeleteBareMetalServerNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteBareMetalServerNetworkAttachmentWithContext(context.Background(), deleteBareMetalServerNetworkAttachmentOptions) +} + +// DeleteBareMetalServerNetworkAttachmentWithContext is an alternate form of the DeleteBareMetalServerNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) DeleteBareMetalServerNetworkAttachmentWithContext(ctx context.Context, deleteBareMetalServerNetworkAttachmentOptions *DeleteBareMetalServerNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteBareMetalServerNetworkAttachmentOptions, "deleteBareMetalServerNetworkAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteBareMetalServerNetworkAttachmentOptions, "deleteBareMetalServerNetworkAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *deleteBareMetalServerNetworkAttachmentOptions.BareMetalServerID, + "id": *deleteBareMetalServerNetworkAttachmentOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteBareMetalServerNetworkAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServerNetworkAttachment") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetBareMetalServerNetworkAttachment : Retrieve a bare metal server network attachment +// This request retrieves a single bare metal server network attachment specified by the identifier in the URL. +func (vpc *VpcV1) GetBareMetalServerNetworkAttachment(getBareMetalServerNetworkAttachmentOptions *GetBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + return vpc.GetBareMetalServerNetworkAttachmentWithContext(context.Background(), getBareMetalServerNetworkAttachmentOptions) +} + +// GetBareMetalServerNetworkAttachmentWithContext is an alternate form of the GetBareMetalServerNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerNetworkAttachmentWithContext(ctx context.Context, getBareMetalServerNetworkAttachmentOptions *GetBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerNetworkAttachmentOptions, "getBareMetalServerNetworkAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getBareMetalServerNetworkAttachmentOptions, "getBareMetalServerNetworkAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *getBareMetalServerNetworkAttachmentOptions.BareMetalServerID, + "id": *getBareMetalServerNetworkAttachmentOptions.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_attachments/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getBareMetalServerNetworkAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkAttachment") + 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, UnmarshalBareMetalServerNetworkAttachment) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateBareMetalServerNetworkAttachment : Update a bare metal server network attachment +// This request updates a bare metal server network attachment with the information provided in a bare metal server +// network attachment patch object. The bare metal server network attachment patch object is structured in the same way +// as a retrieved bare metal server network attachment and contains only the information to be updated. +func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachment(updateBareMetalServerNetworkAttachmentOptions *UpdateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateBareMetalServerNetworkAttachmentWithContext(context.Background(), updateBareMetalServerNetworkAttachmentOptions) +} + +// UpdateBareMetalServerNetworkAttachmentWithContext is an alternate form of the UpdateBareMetalServerNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachmentWithContext(ctx context.Context, updateBareMetalServerNetworkAttachmentOptions *UpdateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBareMetalServerNetworkAttachmentOptions, "updateBareMetalServerNetworkAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateBareMetalServerNetworkAttachmentOptions, "updateBareMetalServerNetworkAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *updateBareMetalServerNetworkAttachmentOptions.BareMetalServerID, + "id": *updateBareMetalServerNetworkAttachmentOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateBareMetalServerNetworkAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerNetworkAttachment") + 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(updateBareMetalServerNetworkAttachmentOptions.BareMetalServerNetworkAttachmentPatch) + 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, UnmarshalBareMetalServerNetworkAttachment) + if err != nil { + return + } + response.Result = result + } + + return +} + // ListBareMetalServerNetworkInterfaces : List all network interfaces on a bare metal server // This request lists all network interfaces on a bare metal server. A bare metal server network interface is an // abstract representation of a network device and attaches a bare metal server to a single subnet. Each network // interface on a bare metal server can attach to any subnet in the zone, including subnets that are already attached to // the bare metal server. +// +// If this bare metal server has network attachments, each returned network interface is a [read-only +// representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network attachment and +// its attached virtual network interface. func (vpc *VpcV1) ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) (result *BareMetalServerNetworkInterfaceCollection, response *core.DetailedResponse, err error) { return vpc.ListBareMetalServerNetworkInterfacesWithContext(context.Background(), listBareMetalServerNetworkInterfacesOptions) } @@ -11688,6 +12379,10 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfacesWithContext(ctx context.Co // contains the information necessary to create the new bare metal server network interface. Any subnet in the bare // metal server's VPC may be specified, even if it is already attached to another bare metal server network interface. // Addresses on the bare metal server network interface must be within the specified subnet's CIDR blocks. +// +// If this bare metal server has network attachments, each network interface is a [read-only +// representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network attachment and +// its attached virtual network interface, and new network interfaces are not allowed to be created. func (vpc *VpcV1) CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { return vpc.CreateBareMetalServerNetworkInterfaceWithContext(context.Background(), createBareMetalServerNetworkInterfaceOptions) } @@ -11759,6 +12454,10 @@ func (vpc *VpcV1) CreateBareMetalServerNetworkInterfaceWithContext(ctx context.C // This request deletes a bare metal server network interface. This operation cannot be reversed. Any floating IPs // associated with the bare metal server network interface are implicitly disassociated. The primary bare metal server // network interface is not allowed to be deleted. +// +// If this bare metal server has network attachments, this network interface is a [read-only +// representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network attachment and +// its attached virtual network interface, and is not allowed to be deleted. func (vpc *VpcV1) DeleteBareMetalServerNetworkInterface(deleteBareMetalServerNetworkInterfaceOptions *DeleteBareMetalServerNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { return vpc.DeleteBareMetalServerNetworkInterfaceWithContext(context.Background(), deleteBareMetalServerNetworkInterfaceOptions) } @@ -11811,6 +12510,10 @@ func (vpc *VpcV1) DeleteBareMetalServerNetworkInterfaceWithContext(ctx context.C // GetBareMetalServerNetworkInterface : Retrieve a bare metal server network interface // This request retrieves a single bare metal server network interface specified by the identifier in the URL. +// +// If this bare metal server has network attachments, the retrieved network interface is a [read-only +// representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network attachment and +// its attached virtual network interface. func (vpc *VpcV1) GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { return vpc.GetBareMetalServerNetworkInterfaceWithContext(context.Background(), getBareMetalServerNetworkInterfaceOptions) } @@ -11877,6 +12580,10 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceWithContext(ctx context.Cont // This request updates a bare metal server network interface with the information provided in a bare metal server // network interface patch object. The bare metal server network interface patch object is structured in the same way as // a retrieved bare metal server network interface and needs to contain only the information to be updated. +// +// If this bare metal server has network attachments, this network interface is a [read-only +// representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network attachment and +// its attached virtual network interface, and is not allowed to be updated. func (vpc *VpcV1) UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { return vpc.UpdateBareMetalServerNetworkInterfaceWithContext(context.Background(), updateBareMetalServerNetworkInterfaceOptions) } @@ -15556,6 +16263,154 @@ func (vpc *VpcV1) ListVirtualNetworkInterfacesWithContext(ctx context.Context, l return } +// CreateVirtualNetworkInterface : Create a virtual network interface +// This request creates a new virtual network interface from a virtual network interface prototype object. The prototype +// object is structured in the same way as a retrieved virtual network interface, and contains the information necessary +// to create the new virtual network interface. +func (vpc *VpcV1) CreateVirtualNetworkInterface(createVirtualNetworkInterfaceOptions *CreateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { + return vpc.CreateVirtualNetworkInterfaceWithContext(context.Background(), createVirtualNetworkInterfaceOptions) +} + +// CreateVirtualNetworkInterfaceWithContext is an alternate form of the CreateVirtualNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) CreateVirtualNetworkInterfaceWithContext(ctx context.Context, createVirtualNetworkInterfaceOptions *CreateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVirtualNetworkInterfaceOptions, "createVirtualNetworkInterfaceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createVirtualNetworkInterfaceOptions, "createVirtualNetworkInterfaceOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createVirtualNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVirtualNetworkInterface") + 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 createVirtualNetworkInterfaceOptions.AllowIPSpoofing != nil { + body["allow_ip_spoofing"] = createVirtualNetworkInterfaceOptions.AllowIPSpoofing + } + if createVirtualNetworkInterfaceOptions.AutoDelete != nil { + body["auto_delete"] = createVirtualNetworkInterfaceOptions.AutoDelete + } + if createVirtualNetworkInterfaceOptions.EnableInfrastructureNat != nil { + body["enable_infrastructure_nat"] = createVirtualNetworkInterfaceOptions.EnableInfrastructureNat + } + if createVirtualNetworkInterfaceOptions.Ips != nil { + body["ips"] = createVirtualNetworkInterfaceOptions.Ips + } + if createVirtualNetworkInterfaceOptions.Name != nil { + body["name"] = createVirtualNetworkInterfaceOptions.Name + } + if createVirtualNetworkInterfaceOptions.PrimaryIP != nil { + body["primary_ip"] = createVirtualNetworkInterfaceOptions.PrimaryIP + } + if createVirtualNetworkInterfaceOptions.ResourceGroup != nil { + body["resource_group"] = createVirtualNetworkInterfaceOptions.ResourceGroup + } + if createVirtualNetworkInterfaceOptions.SecurityGroups != nil { + body["security_groups"] = createVirtualNetworkInterfaceOptions.SecurityGroups + } + if createVirtualNetworkInterfaceOptions.Subnet != nil { + body["subnet"] = createVirtualNetworkInterfaceOptions.Subnet + } + _, err = builder.SetBodyContentJSON(body) + 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, UnmarshalVirtualNetworkInterface) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteVirtualNetworkInterfaces : Delete a virtual network interface +// This request deletes a virtual network interface. This operation cannot be reversed. For this request to succeed, the +// virtual network interface must not be required by another resource, such as the primary network attachment for an +// instance. +func (vpc *VpcV1) DeleteVirtualNetworkInterfaces(deleteVirtualNetworkInterfacesOptions *DeleteVirtualNetworkInterfacesOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVirtualNetworkInterfacesWithContext(context.Background(), deleteVirtualNetworkInterfacesOptions) +} + +// DeleteVirtualNetworkInterfacesWithContext is an alternate form of the DeleteVirtualNetworkInterfaces method which supports a Context parameter +func (vpc *VpcV1) DeleteVirtualNetworkInterfacesWithContext(ctx context.Context, deleteVirtualNetworkInterfacesOptions *DeleteVirtualNetworkInterfacesOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVirtualNetworkInterfacesOptions, "deleteVirtualNetworkInterfacesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteVirtualNetworkInterfacesOptions, "deleteVirtualNetworkInterfacesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteVirtualNetworkInterfacesOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVirtualNetworkInterfacesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVirtualNetworkInterfaces") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + // GetVirtualNetworkInterface : Retrieve a virtual network interface // This request retrieves a single virtual network interface specified by the identifier in the URL. func (vpc *VpcV1) GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptions *GetVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { @@ -15690,6 +16545,533 @@ func (vpc *VpcV1) UpdateVirtualNetworkInterfaceWithContext(ctx context.Context, return } +// ListNetworkInterfaceFloatingIps : List all floating IPs associated with a virtual network interface +// This request lists all floating IPs associated with a virtual network interface. +func (vpc *VpcV1) ListNetworkInterfaceFloatingIps(listNetworkInterfaceFloatingIpsOptions *ListNetworkInterfaceFloatingIpsOptions) (result *FloatingIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { + return vpc.ListNetworkInterfaceFloatingIpsWithContext(context.Background(), listNetworkInterfaceFloatingIpsOptions) +} + +// ListNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListNetworkInterfaceFloatingIps method which supports a Context parameter +func (vpc *VpcV1) ListNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listNetworkInterfaceFloatingIpsOptions *ListNetworkInterfaceFloatingIpsOptions) (result *FloatingIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listNetworkInterfaceFloatingIpsOptions, "listNetworkInterfaceFloatingIpsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listNetworkInterfaceFloatingIpsOptions, "listNetworkInterfaceFloatingIpsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "virtual_network_interface_id": *listNetworkInterfaceFloatingIpsOptions.VirtualNetworkInterfaceID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listNetworkInterfaceFloatingIpsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkInterfaceFloatingIps") + 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 listNetworkInterfaceFloatingIpsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listNetworkInterfaceFloatingIpsOptions.Start)) + } + if listNetworkInterfaceFloatingIpsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listNetworkInterfaceFloatingIpsOptions.Limit)) + } + if listNetworkInterfaceFloatingIpsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listNetworkInterfaceFloatingIpsOptions.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, UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContext) + if err != nil { + return + } + response.Result = result + } + + return +} + +// RemoveNetworkInterfaceFloatingIP : Disassociate a floating IP from a virtual network interface +// This request disassociates the specified floating IP from the specified virtual network interface. +func (vpc *VpcV1) RemoveNetworkInterfaceFloatingIP(removeNetworkInterfaceFloatingIPOptions *RemoveNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { + return vpc.RemoveNetworkInterfaceFloatingIPWithContext(context.Background(), removeNetworkInterfaceFloatingIPOptions) +} + +// RemoveNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) RemoveNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeNetworkInterfaceFloatingIPOptions *RemoveNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(removeNetworkInterfaceFloatingIPOptions, "removeNetworkInterfaceFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(removeNetworkInterfaceFloatingIPOptions, "removeNetworkInterfaceFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "virtual_network_interface_id": *removeNetworkInterfaceFloatingIPOptions.VirtualNetworkInterfaceID, + "id": *removeNetworkInterfaceFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range removeNetworkInterfaceFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveNetworkInterfaceFloatingIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetNetworkInterfaceFloatingIP : Retrieve associated floating IP +// This request retrieves a specified floating IP if it is associated with the virtual network interface specified in +// the URL. +func (vpc *VpcV1) GetNetworkInterfaceFloatingIP(getNetworkInterfaceFloatingIPOptions *GetNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { + return vpc.GetNetworkInterfaceFloatingIPWithContext(context.Background(), getNetworkInterfaceFloatingIPOptions) +} + +// GetNetworkInterfaceFloatingIPWithContext is an alternate form of the GetNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) GetNetworkInterfaceFloatingIPWithContext(ctx context.Context, getNetworkInterfaceFloatingIPOptions *GetNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getNetworkInterfaceFloatingIPOptions, "getNetworkInterfaceFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getNetworkInterfaceFloatingIPOptions, "getNetworkInterfaceFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "virtual_network_interface_id": *getNetworkInterfaceFloatingIPOptions.VirtualNetworkInterfaceID, + "id": *getNetworkInterfaceFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getNetworkInterfaceFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkInterfaceFloatingIP") + 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, UnmarshalFloatingIPReference) + if err != nil { + return + } + response.Result = result + } + + return +} + +// AddNetworkInterfaceFloatingIP : Add an association between a floating IP and a virtual network interface +// This request adds an association between the specified floating IP and the specified virtual network interface. +// +// If the virtual network interface has `enable_infrastructure_nat` set to `true`, no more than one floating IP can be +// associated, and network address translation is performed between the floating IP address and the virtual network +// interface's `primary_ip` address. +// +// If the virtual network interface has `enable_infrastructure_nat` set to `false`, packets are passed unchanged to/from +// the virtual network interface. +// +// The floating IP must: +// - be in the same `zone` as the virtual network interface +// - not currently be associated with another resource +// +// The virtual network interface's `target` must not currently be a file share mount target. +// +// A request body is not required, and if provided, is ignored. +func (vpc *VpcV1) AddNetworkInterfaceFloatingIP(addNetworkInterfaceFloatingIPOptions *AddNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { + return vpc.AddNetworkInterfaceFloatingIPWithContext(context.Background(), addNetworkInterfaceFloatingIPOptions) +} + +// AddNetworkInterfaceFloatingIPWithContext is an alternate form of the AddNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) AddNetworkInterfaceFloatingIPWithContext(ctx context.Context, addNetworkInterfaceFloatingIPOptions *AddNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addNetworkInterfaceFloatingIPOptions, "addNetworkInterfaceFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(addNetworkInterfaceFloatingIPOptions, "addNetworkInterfaceFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "virtual_network_interface_id": *addNetworkInterfaceFloatingIPOptions.VirtualNetworkInterfaceID, + "id": *addNetworkInterfaceFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range addNetworkInterfaceFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddNetworkInterfaceFloatingIP") + 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, UnmarshalFloatingIPReference) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListVirtualNetworkInterfaceIps : List all reserved IPs bound to a virtual network interface +// This request lists all reserved IPs bound to a virtual network interface. +func (vpc *VpcV1) ListVirtualNetworkInterfaceIps(listVirtualNetworkInterfaceIpsOptions *ListVirtualNetworkInterfaceIpsOptions) (result *ReservedIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { + return vpc.ListVirtualNetworkInterfaceIpsWithContext(context.Background(), listVirtualNetworkInterfaceIpsOptions) +} + +// ListVirtualNetworkInterfaceIpsWithContext is an alternate form of the ListVirtualNetworkInterfaceIps method which supports a Context parameter +func (vpc *VpcV1) ListVirtualNetworkInterfaceIpsWithContext(ctx context.Context, listVirtualNetworkInterfaceIpsOptions *ListVirtualNetworkInterfaceIpsOptions) (result *ReservedIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVirtualNetworkInterfaceIpsOptions, "listVirtualNetworkInterfaceIpsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listVirtualNetworkInterfaceIpsOptions, "listVirtualNetworkInterfaceIpsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "virtual_network_interface_id": *listVirtualNetworkInterfaceIpsOptions.VirtualNetworkInterfaceID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listVirtualNetworkInterfaceIpsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVirtualNetworkInterfaceIps") + 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 listVirtualNetworkInterfaceIpsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVirtualNetworkInterfaceIpsOptions.Start)) + } + if listVirtualNetworkInterfaceIpsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVirtualNetworkInterfaceIpsOptions.Limit)) + } + if listVirtualNetworkInterfaceIpsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listVirtualNetworkInterfaceIpsOptions.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, UnmarshalReservedIPCollectionVirtualNetworkInterfaceContext) + if err != nil { + return + } + response.Result = result + } + + return +} + +// RemoveVirtualNetworkInterfaceIP : Unbind a reserved IP from a virtual network interface +// This request unbinds the specified reserved IP from the specified virtual network interface. If the reserved IP has +// `auto_delete` set to `true`, the reserved IP will be deleted. +// +// The reserved IP for the `primary_ip` cannot be unbound. +func (vpc *VpcV1) RemoveVirtualNetworkInterfaceIP(removeVirtualNetworkInterfaceIPOptions *RemoveVirtualNetworkInterfaceIPOptions) (response *core.DetailedResponse, err error) { + return vpc.RemoveVirtualNetworkInterfaceIPWithContext(context.Background(), removeVirtualNetworkInterfaceIPOptions) +} + +// RemoveVirtualNetworkInterfaceIPWithContext is an alternate form of the RemoveVirtualNetworkInterfaceIP method which supports a Context parameter +func (vpc *VpcV1) RemoveVirtualNetworkInterfaceIPWithContext(ctx context.Context, removeVirtualNetworkInterfaceIPOptions *RemoveVirtualNetworkInterfaceIPOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(removeVirtualNetworkInterfaceIPOptions, "removeVirtualNetworkInterfaceIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(removeVirtualNetworkInterfaceIPOptions, "removeVirtualNetworkInterfaceIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "virtual_network_interface_id": *removeVirtualNetworkInterfaceIPOptions.VirtualNetworkInterfaceID, + "id": *removeVirtualNetworkInterfaceIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range removeVirtualNetworkInterfaceIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVirtualNetworkInterfaceIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetVirtualNetworkInterfaceIP : Retrieve bound reserved IP +// This request retrieves the specified reserved IP address if it is bound to the virtual network interface specified in +// the URL. +func (vpc *VpcV1) GetVirtualNetworkInterfaceIP(getVirtualNetworkInterfaceIPOptions *GetVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { + return vpc.GetVirtualNetworkInterfaceIPWithContext(context.Background(), getVirtualNetworkInterfaceIPOptions) +} + +// GetVirtualNetworkInterfaceIPWithContext is an alternate form of the GetVirtualNetworkInterfaceIP method which supports a Context parameter +func (vpc *VpcV1) GetVirtualNetworkInterfaceIPWithContext(ctx context.Context, getVirtualNetworkInterfaceIPOptions *GetVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVirtualNetworkInterfaceIPOptions, "getVirtualNetworkInterfaceIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVirtualNetworkInterfaceIPOptions, "getVirtualNetworkInterfaceIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "virtual_network_interface_id": *getVirtualNetworkInterfaceIPOptions.VirtualNetworkInterfaceID, + "id": *getVirtualNetworkInterfaceIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVirtualNetworkInterfaceIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVirtualNetworkInterfaceIP") + 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, UnmarshalReservedIPReference) + if err != nil { + return + } + response.Result = result + } + + return +} + +// AddVirtualNetworkInterfaceIP : Bind a reserved IP to a virtual network interface +// This request binds the specified reserved IP to the specified virtual network interface. +// +// The reserved IP must currently be unbound and in the primary IP's subnet. The virtual network interface's `target` +// must not currently be a file share mount target. +func (vpc *VpcV1) AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptions *AddVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { + return vpc.AddVirtualNetworkInterfaceIPWithContext(context.Background(), addVirtualNetworkInterfaceIPOptions) +} + +// AddVirtualNetworkInterfaceIPWithContext is an alternate form of the AddVirtualNetworkInterfaceIP method which supports a Context parameter +func (vpc *VpcV1) AddVirtualNetworkInterfaceIPWithContext(ctx context.Context, addVirtualNetworkInterfaceIPOptions *AddVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addVirtualNetworkInterfaceIPOptions, "addVirtualNetworkInterfaceIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(addVirtualNetworkInterfaceIPOptions, "addVirtualNetworkInterfaceIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "virtual_network_interface_id": *addVirtualNetworkInterfaceIPOptions.VirtualNetworkInterfaceID, + "id": *addVirtualNetworkInterfaceIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range addVirtualNetworkInterfaceIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVirtualNetworkInterfaceIP") + 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, UnmarshalReservedIPReference) + if err != nil { + return + } + response.Result = result + } + + return +} + // ListPublicGateways : List all public gateways // This request lists all public gateways in the region. A public gateway is a virtual network device associated with a // VPC, which allows access to the Internet. A public gateway resides in a zone and can be connected to subnets in the @@ -16073,6 +17455,18 @@ func (vpc *VpcV1) ListFloatingIpsWithContext(ctx context.Context, listFloatingIp if listFloatingIpsOptions.Sort != nil { builder.AddQuery("sort", fmt.Sprint(*listFloatingIpsOptions.Sort)) } + if listFloatingIpsOptions.TargetID != nil { + builder.AddQuery("target.id", fmt.Sprint(*listFloatingIpsOptions.TargetID)) + } + if listFloatingIpsOptions.TargetCRN != nil { + builder.AddQuery("target.crn", fmt.Sprint(*listFloatingIpsOptions.TargetCRN)) + } + if listFloatingIpsOptions.TargetName != nil { + builder.AddQuery("target.name", fmt.Sprint(*listFloatingIpsOptions.TargetName)) + } + if listFloatingIpsOptions.TargetResourceType != nil { + builder.AddQuery("target.resource_type", fmt.Sprint(*listFloatingIpsOptions.TargetResourceType)) + } request, err := builder.Build() if err != nil { @@ -21068,9 +22462,6 @@ func (vpc *VpcV1) CreateLoadBalancerWithContext(ctx context.Context, createLoadB if createLoadBalancerOptions.Subnets != nil { body["subnets"] = createLoadBalancerOptions.Subnets } - if createLoadBalancerOptions.Datapath != nil { - body["datapath"] = createLoadBalancerOptions.Datapath - } if createLoadBalancerOptions.Dns != nil { body["dns"] = createLoadBalancerOptions.Dns } @@ -21126,7 +22517,7 @@ func (vpc *VpcV1) CreateLoadBalancerWithContext(ctx context.Context, createLoadB // 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`. +// `provisioning_status` is `delete_pending` or it is referenced by a resource. func (vpc *VpcV1) DeleteLoadBalancer(deleteLoadBalancerOptions *DeleteLoadBalancerOptions) (response *core.DetailedResponse, err error) { return vpc.DeleteLoadBalancerWithContext(context.Background(), deleteLoadBalancerOptions) } @@ -23521,7 +24912,7 @@ func (vpc *VpcV1) GetEndpointGatewayIPWithContext(ctx context.Context, getEndpoi // 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 currently be unbound, or not required by its target // - 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) @@ -23773,7 +25164,7 @@ func (vpc *VpcV1) UpdateEndpointGatewayWithContext(ctx context.Context, updateEn // ListFlowLogCollectors : List all flow log collectors // This request lists all flow log collectors in the region. A flow log collector summarizes data sent over the instance -// network interfaces contained within its target. +// network interfaces and instance network attachments contained within its target. func (vpc *VpcV1) ListFlowLogCollectors(listFlowLogCollectorsOptions *ListFlowLogCollectorsOptions) (result *FlowLogCollectorCollection, response *core.DetailedResponse, err error) { return vpc.ListFlowLogCollectorsWithContext(context.Background(), listFlowLogCollectorsOptions) } @@ -24288,6 +25679,82 @@ func (options *AddInstanceNetworkInterfaceFloatingIPOptions) SetHeaders(param ma return options } +// AddNetworkInterfaceFloatingIPOptions : The AddNetworkInterfaceFloatingIP options. +type AddNetworkInterfaceFloatingIPOptions struct { + // The virtual network interface identifier. + VirtualNetworkInterfaceID *string `json:"virtual_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 +} + +// NewAddNetworkInterfaceFloatingIPOptions : Instantiate AddNetworkInterfaceFloatingIPOptions +func (*VpcV1) NewAddNetworkInterfaceFloatingIPOptions(virtualNetworkInterfaceID string, id string) *AddNetworkInterfaceFloatingIPOptions { + return &AddNetworkInterfaceFloatingIPOptions{ + VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID), + ID: core.StringPtr(id), + } +} + +// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID +func (_options *AddNetworkInterfaceFloatingIPOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *AddNetworkInterfaceFloatingIPOptions { + _options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *AddNetworkInterfaceFloatingIPOptions) SetID(id string) *AddNetworkInterfaceFloatingIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *AddNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *AddNetworkInterfaceFloatingIPOptions { + options.Headers = param + return options +} + +// AddVirtualNetworkInterfaceIPOptions : The AddVirtualNetworkInterfaceIP options. +type AddVirtualNetworkInterfaceIPOptions struct { + // The virtual network interface identifier. + VirtualNetworkInterfaceID *string `json:"virtual_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 +} + +// NewAddVirtualNetworkInterfaceIPOptions : Instantiate AddVirtualNetworkInterfaceIPOptions +func (*VpcV1) NewAddVirtualNetworkInterfaceIPOptions(virtualNetworkInterfaceID string, id string) *AddVirtualNetworkInterfaceIPOptions { + return &AddVirtualNetworkInterfaceIPOptions{ + VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID), + ID: core.StringPtr(id), + } +} + +// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID +func (_options *AddVirtualNetworkInterfaceIPOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *AddVirtualNetworkInterfaceIPOptions { + _options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *AddVirtualNetworkInterfaceIPOptions) SetID(id string) *AddVirtualNetworkInterfaceIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *AddVirtualNetworkInterfaceIPOptions) SetHeaders(param map[string]string) *AddVirtualNetworkInterfaceIPOptions { + options.Headers = param + return options +} + // AddVPNGatewayConnectionLocalCIDROptions : The AddVPNGatewayConnectionLocalCIDR options. type AddVPNGatewayConnectionLocalCIDROptions struct { // The VPN gateway identifier. @@ -26149,7 +27616,8 @@ func UnmarshalBackupPolicyScopePrototype(m map[string]json.RawMessage, result in // BareMetalServer : BareMetalServer struct type BareMetalServer struct { - // The total bandwidth (in megabits per second) shared across the bare metal server network interfaces. + // The total bandwidth (in megabits per second) shared across the bare metal server network attachments or bare metal + // server network interfaces. Bandwidth *int64 `json:"bandwidth" validate:"required"` // The possible resource types for this property are expected to expand in the future. @@ -26194,10 +27662,25 @@ type BareMetalServer struct { // The name for this bare metal server. The name is unique across all bare metal servers in the region. Name *string `json:"name" validate:"required"` + // The network attachments for this bare metal server, including the primary network attachment. + NetworkAttachments []BareMetalServerNetworkAttachmentReference `json:"network_attachments,omitempty"` + // The network interfaces for this bare metal server, including the primary network interface. + // + // If this bare metal server has network attachments, each network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface. NetworkInterfaces []NetworkInterfaceBareMetalServerContextReference `json:"network_interfaces" validate:"required"` + // The primary network attachment for this bare metal server. + PrimaryNetworkAttachment *BareMetalServerNetworkAttachmentReference `json:"primary_network_attachment,omitempty"` + // The primary network interface for this bare metal server. + // + // If this bare metal server has network attachments, this primary network interface is + // a [read-only + // representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) + // of the primary network attachment and its attached virtual network interface. PrimaryNetworkInterface *NetworkInterfaceBareMetalServerContextReference `json:"primary_network_interface" validate:"required"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) @@ -26316,10 +27799,18 @@ func UnmarshalBareMetalServer(m map[string]json.RawMessage, result interface{}) if err != nil { return } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalBareMetalServerNetworkAttachmentReference) + if err != nil { + return + } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfaceBareMetalServerContextReference) if err != nil { return } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalBareMetalServerNetworkAttachmentReference) + if err != nil { + return + } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfaceBareMetalServerContextReference) if err != nil { return @@ -26933,205 +28424,224 @@ func UnmarshalBareMetalServerLifecycleReason(m map[string]json.RawMessage, resul return } -// BareMetalServerNetworkInterface : BareMetalServerNetworkInterface struct +// BareMetalServerNetworkAttachment : BareMetalServerNetworkAttachment struct // Models which "extend" this model: -// - BareMetalServerNetworkInterfaceByHiperSocket -// - BareMetalServerNetworkInterfaceByPci -// - BareMetalServerNetworkInterfaceByVlan -type BareMetalServerNetworkInterface struct { - // Indicates whether source IP spoofing is allowed on this bare metal server network interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"` - - // The date and time that the bare metal server network interface was created. +// - BareMetalServerNetworkAttachmentByPci +// - BareMetalServerNetworkAttachmentByVlan +type BareMetalServerNetworkAttachment struct { + // The date and time that the bare metal server network attachment was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - // If `true`: - // - The VPC infrastructure performs any needed NAT operations. - // - `floating_ips` must not have more than one floating IP. - // - // If `false`: - // - Packets are passed unchanged to/from the bare metal server network interface, - // allowing the workload to perform any needed NAT operations. - // - `allow_ip_spoofing` must be `false`. - // - `interface_type` must not be `hipersocket`. - EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` - - // The floating IPs associated with this bare metal server network interface. - FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` - - // The URL for this bare metal server network interface. + // The URL for this bare metal server network attachment. Href *string `json:"href" validate:"required"` - // The unique identifier for this bare metal server network interface. + // The unique identifier for this bare metal server network attachment. ID *string `json:"id" validate:"required"` - // The interface type: - // - `hipersocket`: a virtual device that provides high-speed TCP/IP connectivity - // within a `s390x` based system + // The network attachment's 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 + // to use the PCI attachment // - Cannot directly use an IEEE 802.1Q 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. // // 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 MAC address of this bare metal server network interface. If the MAC address has not yet been selected, the value - // will be an empty string. - MacAddress *string `json:"mac_address" validate:"required"` + // The lifecycle state of the bare metal server network attachment. + LifecycleState *string `json:"lifecycle_state" validate:"required"` - // The name for this bare metal server network interface. + // The name for this bare metal server network attachment. The name is unique across all network attachments for the + // bare metal server. Name *string `json:"name" validate:"required"` - // The bare metal server network interface port speed in Mbps. + // The port speed for this bare metal server network attachment in Mbps. PortSpeed *int64 `json:"port_speed" validate:"required"` + // The primary IP address of the virtual network interface for the bare metal server + // network attachment. PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` // The resource type. ResourceType *string `json:"resource_type" validate:"required"` - // The security groups targeting this bare metal server network interface. - SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` - - // The status of the bare metal server network interface. - Status *string `json:"status" validate:"required"` - - // The associated subnet. + // The subnet of the virtual network interface for the bare metal server network + // attachment. Subnet *SubnetReference `json:"subnet" validate:"required"` - // The bare metal server network interface type. + // The bare metal server network attachment type. Type *string `json:"type" validate:"required"` - // The VLAN IDs allowed for `vlan` interfaces using this PCI interface. + // The virtual network interface for this bare metal server network attachment. + VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" validate:"required"` + + // The VLAN IDs allowed for `vlan` attachments using this PCI attachment. AllowedVlans []int64 `json:"allowed_vlans,omitempty"` - // Indicates if the data path for the network interface can float to another bare metal server. Can only be `true` for - // network interfaces with an `interface_type` of `vlan`. + // Indicates if the data path for the network attachment can float to another bare metal server. Can only be `true` for + // network attachments with an `interface_type` of `vlan`. // // If `true`, and the network detects traffic for this data path on another bare metal server in the resource group, - // the network interface will be automatically deleted from this bare metal server and a new network interface with the - // same `id`, `name` and `vlan` will be created on the other bare metal server. + // the network attachment will be automatically deleted from this bare metal server and a new network attachment with + // the same `id`, `name` and `vlan` will be created on the other bare metal server. The virtual network interface for + // this network attachment will be automatically be attached to the new network attachment. // // For the data path to float, the other bare metal server must be in the same - // `resource_group`, and must have a network interface with `interface_type` of `pci` with `allowed_vlans` including - // this network interface's `vlan`. - AllowInterfaceToFloat *bool `json:"allow_interface_to_float,omitempty"` + // `resource_group`, and must have a network attachment with `interface_type` of `pci` with `allowed_vlans` including + // this network attachment's `vlan`. + AllowToFloat *bool `json:"allow_to_float,omitempty"` - // The VLAN ID used in the IEEE 802.1Q tag present in all traffic on this interface. + // The IEEE 802.1Q VLAN ID that must be used for all traffic on this attachment. Vlan *int64 `json:"vlan,omitempty"` } -// Constants associated with the BareMetalServerNetworkInterface.InterfaceType property. -// The interface type: -// - `hipersocket`: a virtual device that provides high-speed TCP/IP connectivity -// within a `s390x` based system +// Constants associated with the BareMetalServerNetworkAttachment.InterfaceType property. +// The network attachment's 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 +// to use the PCI attachment // - Cannot directly use an IEEE 802.1Q 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. // // 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 ( - BareMetalServerNetworkInterfaceInterfaceTypeHipersocketConst = "hipersocket" - BareMetalServerNetworkInterfaceInterfaceTypePciConst = "pci" - BareMetalServerNetworkInterfaceInterfaceTypeVlanConst = "vlan" + BareMetalServerNetworkAttachmentInterfaceTypePciConst = "pci" + BareMetalServerNetworkAttachmentInterfaceTypeVlanConst = "vlan" ) -// Constants associated with the BareMetalServerNetworkInterface.ResourceType property. -// The resource type. +// Constants associated with the BareMetalServerNetworkAttachment.LifecycleState property. +// The lifecycle state of the bare metal server network attachment. const ( - BareMetalServerNetworkInterfaceResourceTypeNetworkInterfaceConst = "network_interface" + BareMetalServerNetworkAttachmentLifecycleStateDeletingConst = "deleting" + BareMetalServerNetworkAttachmentLifecycleStateFailedConst = "failed" + BareMetalServerNetworkAttachmentLifecycleStatePendingConst = "pending" + BareMetalServerNetworkAttachmentLifecycleStateStableConst = "stable" + BareMetalServerNetworkAttachmentLifecycleStateSuspendedConst = "suspended" + BareMetalServerNetworkAttachmentLifecycleStateUpdatingConst = "updating" + BareMetalServerNetworkAttachmentLifecycleStateWaitingConst = "waiting" ) -// Constants associated with the BareMetalServerNetworkInterface.Status property. -// The status of the bare metal server network interface. +// Constants associated with the BareMetalServerNetworkAttachment.ResourceType property. +// The resource type. const ( - BareMetalServerNetworkInterfaceStatusAvailableConst = "available" - BareMetalServerNetworkInterfaceStatusDeletingConst = "deleting" - BareMetalServerNetworkInterfaceStatusFailedConst = "failed" - BareMetalServerNetworkInterfaceStatusPendingConst = "pending" + BareMetalServerNetworkAttachmentResourceTypeBareMetalServerNetworkAttachmentConst = "bare_metal_server_network_attachment" ) -// Constants associated with the BareMetalServerNetworkInterface.Type property. -// The bare metal server network interface type. +// Constants associated with the BareMetalServerNetworkAttachment.Type property. +// The bare metal server network attachment type. const ( - BareMetalServerNetworkInterfaceTypePrimaryConst = "primary" - BareMetalServerNetworkInterfaceTypeSecondaryConst = "secondary" + BareMetalServerNetworkAttachmentTypePrimaryConst = "primary" + BareMetalServerNetworkAttachmentTypeSecondaryConst = "secondary" ) -func (*BareMetalServerNetworkInterface) isaBareMetalServerNetworkInterface() bool { +func (*BareMetalServerNetworkAttachment) isaBareMetalServerNetworkAttachment() bool { return true } -type BareMetalServerNetworkInterfaceIntf interface { - isaBareMetalServerNetworkInterface() bool +type BareMetalServerNetworkAttachmentIntf interface { + isaBareMetalServerNetworkAttachment() 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) +// UnmarshalBareMetalServerNetworkAttachment unmarshals an instance of BareMetalServerNetworkAttachment from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachment) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) 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 == "hipersocket" { - err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfaceByHiperSocket) - } else 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, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allow_to_float", &obj.AllowToFloat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "vlan", &obj.Vlan) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerNetworkInterfaceCollection : BareMetalServerNetworkInterfaceCollection struct -type BareMetalServerNetworkInterfaceCollection struct { +// BareMetalServerNetworkAttachmentCollection : BareMetalServerNetworkAttachmentCollection struct +type BareMetalServerNetworkAttachmentCollection struct { // A link to the first page of resources. - First *BareMetalServerNetworkInterfaceCollectionFirst `json:"first" validate:"required"` + First *BareMetalServerNetworkAttachmentCollectionFirst `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` - // Collection of bare metal server network interfaces. - NetworkInterfaces []BareMetalServerNetworkInterfaceIntf `json:"network_interfaces" validate:"required"` + // Collection of bare metal server network attachments. + NetworkAttachments []BareMetalServerNetworkAttachmentIntf `json:"network_attachments" 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 *BareMetalServerNetworkAttachmentCollectionNext `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) +// UnmarshalBareMetalServerNetworkAttachmentCollection unmarshals an instance of BareMetalServerNetworkAttachmentCollection from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBareMetalServerNetworkAttachmentCollectionFirst) if err != nil { return } @@ -27139,11 +28649,11 @@ func UnmarshalBareMetalServerNetworkInterfaceCollection(m map[string]json.RawMes if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalBareMetalServerNetworkInterface) + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalBareMetalServerNetworkAttachment) if err != nil { return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerNetworkInterfaceCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerNetworkAttachmentCollectionNext) if err != nil { return } @@ -27156,7 +28666,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 *BareMetalServerNetworkAttachmentCollection) GetNextStart() (*string, error) { if core.IsNil(resp.Next) { return nil, nil } @@ -27167,15 +28677,15 @@ func (resp *BareMetalServerNetworkInterfaceCollection) GetNextStart() (*string, return start, nil } -// BareMetalServerNetworkInterfaceCollectionFirst : A link to the first page of resources. -type BareMetalServerNetworkInterfaceCollectionFirst struct { +// BareMetalServerNetworkAttachmentCollectionFirst : A link to the first page of resources. +type BareMetalServerNetworkAttachmentCollectionFirst 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) +// UnmarshalBareMetalServerNetworkAttachmentCollectionFirst unmarshals an instance of BareMetalServerNetworkAttachmentCollectionFirst from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentCollectionFirst) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -27184,15 +28694,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 { +// BareMetalServerNetworkAttachmentCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type BareMetalServerNetworkAttachmentCollectionNext 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) +// UnmarshalBareMetalServerNetworkAttachmentCollectionNext unmarshals an instance of BareMetalServerNetworkAttachmentCollectionNext from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentCollectionNext) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -27201,46 +28711,24 @@ func UnmarshalBareMetalServerNetworkInterfaceCollectionNext(m map[string]json.Ra return } -// BareMetalServerNetworkInterfacePatch : BareMetalServerNetworkInterfacePatch struct -type BareMetalServerNetworkInterfacePatch struct { - // Indicates whether source IP spoofing is allowed on this bare metal server network interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` - - // The VLAN IDs to allow for `vlan` interfaces using this PCI interface, replacing any existing VLAN IDs. The specified - // values must include IDs for all `vlan` interfaces currently using this PCI interface. +// BareMetalServerNetworkAttachmentPatch : BareMetalServerNetworkAttachmentPatch struct +type BareMetalServerNetworkAttachmentPatch struct { + // The VLAN IDs to allow for `vlan` attachments using this PCI attachment, replacing any existing VLAN IDs. The + // specified values must include IDs for all `vlan` attachments currently using this PCI attachment. AllowedVlans []int64 `json:"allowed_vlans,omitempty"` - // If `true`: - // - The VPC infrastructure performs any needed NAT operations. - // - `floating_ips` must not have more than one floating IP. - // - // If `false`: - // - Packets are passed unchanged to/from the bare metal server network interface, - // allowing the workload to perform any needed NAT operations. - // - `allow_ip_spoofing` must be `false`. - // - `interface_type` must not be `hipersocket`. - EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` - - // The name for this bare metal server network interface. The name must not be used by another network interface on the - // bare metal server. + // The name for this network attachment. The name must not be used by another network attachment for the bare metal + // server. 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 - } +// UnmarshalBareMetalServerNetworkAttachmentPatch unmarshals an instance of BareMetalServerNetworkAttachmentPatch from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentPatch) 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 @@ -27249,212 +28737,115 @@ func UnmarshalBareMetalServerNetworkInterfacePatch(m map[string]json.RawMessage, return } -// AsPatch returns a generic map representation of the BareMetalServerNetworkInterfacePatch -func (bareMetalServerNetworkInterfacePatch *BareMetalServerNetworkInterfacePatch) AsPatch() (_patch map[string]interface{}, err error) { +// AsPatch returns a generic map representation of the BareMetalServerNetworkAttachmentPatch +func (bareMetalServerNetworkAttachmentPatch *BareMetalServerNetworkAttachmentPatch) AsPatch() (_patch map[string]interface{}, err error) { var jsonData []byte - jsonData, err = json.Marshal(bareMetalServerNetworkInterfacePatch) + jsonData, err = json.Marshal(bareMetalServerNetworkAttachmentPatch) if err == nil { err = json.Unmarshal(jsonData, &_patch) } return } -// BareMetalServerNetworkInterfacePrototype : BareMetalServerNetworkInterfacePrototype struct +// BareMetalServerNetworkAttachmentPrototype : BareMetalServerNetworkAttachmentPrototype struct // Models which "extend" this model: -// - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype -// - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype -// - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype -type BareMetalServerNetworkInterfacePrototype struct { - // Indicates whether source IP spoofing is allowed on this bare metal server network interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` - - // If `true`: - // - The VPC infrastructure performs any needed NAT operations. - // - `floating_ips` must not have more than one floating IP. - // - // If `false`: - // - Packets are passed unchanged to/from the bare metal server network interface, - // allowing the workload to perform any needed NAT operations. - // - `allow_ip_spoofing` must be `false`. - // - `interface_type` must not be `hipersocket`. - EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` - - // The interface type: - // - `hipersocket`: a virtual device that provides high-speed TCP/IP connectivity - // within a `s390x` based system - // - Not supported on bare metal servers with a `cpu.architecture` of `amd64` +// - BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype +// - BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype +type BareMetalServerNetworkAttachmentPrototype struct { + // The network attachment's 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 + // to use the PCI attachment // - Cannot directly use an IEEE 802.1Q tag. // - Not supported on bare metal servers with a `cpu.architecture` of `s390x` // - `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. // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. InterfaceType *string `json:"interface_type" validate:"required"` - // The name for this bare metal server network interface. The name must not be used by another network interface on the - // bare metal server. If unspecified, the name will be a hyphenated list of randomly-selected words. + // The name for this bare metal server network attachment. Names must be unique within the bare metal server the + // network attachment 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 bare metal server network interface. This can be - // specified using an existing reserved IP, or a prototype object for a new reserved IP. + // A virtual network interface for the bare metal server network attachment. This can be + // specified using an existing virtual network interface, or a prototype object for a new + // virtual network interface. // - // If an existing reserved IP or a prototype object with an address is specified, it must - // be available on the bare metal server 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 bare metal server 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"` + // If an existing virtual network interface is specified, it must not be the target of a flow + // log collector. + VirtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf `json:"virtual_network_interface" validate:"required"` - // The VLAN IDs to allow for `vlan` interfaces using this PCI interface. + // The VLAN IDs to allow for `vlan` attachments using this PCI attachment. AllowedVlans []int64 `json:"allowed_vlans,omitempty"` - // Indicates if the data path for the network interface can float to another bare metal server. Can only be `true` for - // network interfaces with an `interface_type` of `vlan`. + // Indicates if the data path for the network attachment can float to another bare metal server. Can only be `true` for + // network attachments with an `interface_type` of `vlan`. // // If `true`, and the network detects traffic for this data path on another bare metal server in the resource group, - // the network interface will be automatically deleted from this bare metal server and a new network interface with the - // same `id`, `name` and `vlan` will be created on the other bare metal server. + // the network attachment will be automatically deleted from this bare metal server and a new network attachment with + // the same `id`, `name` and `vlan` will be created on the other bare metal server. The virtual network interface for + // this network attachment will be automatically be attached to the new network attachment. // // For the data path to float, the other bare metal server must be in the same - // `resource_group`, and must have a network interface with `interface_type` of `pci` with `allowed_vlans` including - // this network interface's `vlan`. - AllowInterfaceToFloat *bool `json:"allow_interface_to_float,omitempty"` + // `resource_group`, and must have a network attachment with `interface_type` of `pci` with `allowed_vlans` including + // this network attachment's `vlan`. + AllowToFloat *bool `json:"allow_to_float,omitempty"` - // The VLAN ID used in the IEEE 802.1Q tag present in all traffic on this interface. + // The IEEE 802.1Q VLAN ID that must be used for all traffic on this attachment. Vlan *int64 `json:"vlan,omitempty"` } -// Constants associated with the BareMetalServerNetworkInterfacePrototype.InterfaceType property. -// The interface type: -// - `hipersocket`: a virtual device that provides high-speed TCP/IP connectivity -// within a `s390x` based system -// - Not supported on bare metal servers with a `cpu.architecture` of `amd64` +// Constants associated with the BareMetalServerNetworkAttachmentPrototype.InterfaceType property. +// The network attachment's 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 +// to use the PCI attachment // - Cannot directly use an IEEE 802.1Q tag. // - Not supported on bare metal servers with a `cpu.architecture` of `s390x` // - `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. // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. const ( - BareMetalServerNetworkInterfacePrototypeInterfaceTypeHipersocketConst = "hipersocket" - BareMetalServerNetworkInterfacePrototypeInterfaceTypePciConst = "pci" - BareMetalServerNetworkInterfacePrototypeInterfaceTypeVlanConst = "vlan" + BareMetalServerNetworkAttachmentPrototypeInterfaceTypePciConst = "pci" + BareMetalServerNetworkAttachmentPrototypeInterfaceTypeVlanConst = "vlan" ) -func (*BareMetalServerNetworkInterfacePrototype) isaBareMetalServerNetworkInterfacePrototype() bool { +func (*BareMetalServerNetworkAttachmentPrototype) isaBareMetalServerNetworkAttachmentPrototype() bool { return true } -type BareMetalServerNetworkInterfacePrototypeIntf interface { - isaBareMetalServerNetworkInterfacePrototype() bool +type BareMetalServerNetworkAttachmentPrototypeIntf interface { + isaBareMetalServerNetworkAttachmentPrototype() 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) +// UnmarshalBareMetalServerNetworkAttachmentPrototype unmarshals an instance of BareMetalServerNetworkAttachmentPrototype from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentPrototype) + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) 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 == "hipersocket" { - err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) - } else 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 -} - -// BareMetalServerNetworkInterfaceReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type BareMetalServerNetworkInterfaceReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalBareMetalServerNetworkInterfaceReferenceDeleted unmarshals an instance of BareMetalServerNetworkInterfaceReferenceDeleted from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfaceReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfaceReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerNetworkInterfaceReferenceTargetContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type BareMetalServerNetworkInterfaceReferenceTargetContextDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalBareMetalServerNetworkInterfaceReferenceTargetContextDeleted unmarshals an instance of BareMetalServerNetworkInterfaceReferenceTargetContextDeleted from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfaceReferenceTargetContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfaceReferenceTargetContextDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerPatch : BareMetalServerPatch struct -type BareMetalServerPatch struct { - // Indicates whether secure boot is enabled. If enabled, the image must support secure boot or the bare metal server - // will fail to boot. - // - // For `enable_secure_boot` to be changed, the bare metal server `status` must be - // `stopped`. - EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` - - // The name for this bare metal server. The name must not be used by another bare metal server in the region. Changing - // the name will not affect the system hostname. - Name *string `json:"name,omitempty"` - - TrustedPlatformModule *BareMetalServerTrustedPlatformModulePatch `json:"trusted_platform_module,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, "enable_secure_boot", &obj.EnableSecureBoot) + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "allow_to_float", &obj.AllowToFloat) if err != nil { return } - err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePatch) + err = core.UnmarshalPrimitive(m, "vlan", &obj.Vlan) if err != nil { return } @@ -27462,100 +28853,99 @@ 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) - } - return -} - -// BareMetalServerPrimaryNetworkInterfacePrototype : BareMetalServerPrimaryNetworkInterfacePrototype struct -type BareMetalServerPrimaryNetworkInterfacePrototype struct { - // Indicates whether source IP spoofing is allowed on this bare metal server network interface. +// BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface : A virtual network interface for the bare metal server network attachment. This can be specified using an existing +// virtual network interface, or a prototype object for a new virtual network interface. +// +// If an existing virtual network interface is specified, it must not be the target of a flow log collector. +// Models which "extend" this model: +// - BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext +// - BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity +type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface 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"` - // The VLAN IDs allowed for `vlan` interfaces using this PCI interface. - AllowedVlans []int64 `json:"allowed_vlans,omitempty"` + // Indicates whether this virtual network interface will be automatically deleted when + // `target` is deleted. + AutoDelete *bool `json:"auto_delete,omitempty"` // If `true`: // - The VPC infrastructure performs any needed NAT operations. // - `floating_ips` must not have more than one floating IP. // // If `false`: - // - Packets are passed unchanged to/from the bare metal server network interface, + // - Packets are passed unchanged to/from the virtual network interface, // allowing the workload to perform any needed NAT operations. // - `allow_ip_spoofing` must be `false`. - // - `interface_type` must not be `hipersocket`. + // - Can only be attached to a `target` with a `resource_type` of + // `bare_metal_server_network_attachment`. EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` - // The interface type: - // - `hipersocket`: a virtual device that provides high-speed TCP/IP connectivity - // within a `s390x` based system. - // - Not supported on bare metal servers with a `cpu.architecture` of `amd64` - // - `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 tag. - // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. - InterfaceType *string `json:"interface_type,omitempty"` + // Additional IP addresses to bind to the virtual network interface. Each item may be either a reserved IP identity, or + // a reserved IP prototype object which will be used to create a new reserved IP. All IP addresses must be in the + // primary IP's subnet. + // + // If reserved IP identities are provided, the specified reserved IPs must be unbound. + // + // If reserved IP prototype objects with addresses are provided, the addresses must be available on the virtual network + // interface's subnet. For any prototype objects that do not specify an address, an available address on the subnet + // will be automatically selected and reserved. + Ips []VirtualNetworkInterfaceIPPrototypeIntf `json:"ips,omitempty"` - // The name for this bare metal server network interface. The name must not be used by another network interface on the - // bare metal server. If unspecified, the name will be a hyphenated list of randomly-selected words. + // The name for this virtual network interface. The name must not be used by another virtual network interface in the + // VPC. If unspecified, the name will be a hyphenated list of randomly-selected words. Names beginning with `ibm-` are + // reserved for provider-owned resources, and are not allowed. Name *string `json:"name,omitempty"` - // The primary IP address to bind to the bare metal server network interface. This can be - // specified using an existing reserved IP, or a prototype object for a new reserved IP. + // The primary IP address to bind to the virtual network interface. May be either a + // reserved IP identity, or a reserved IP prototype object which will be used to create a + // new reserved IP. // - // If an existing reserved IP or a prototype object with an address is specified, it must - // be available on the bare metal server network interface's subnet. Otherwise, an - // available address on the subnet will be automatically selected and reserved. - PrimaryIP NetworkInterfaceIPPrototypeIntf `json:"primary_ip,omitempty"` + // If a reserved IP identity is provided, the specified reserved IP must be unbound. + // + // If a reserved IP prototype object with an address is provided, the address must be + // available on the virtual network interface's subnet. If no address is specified, + // an available address on the subnet will be automatically selected and reserved. + PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"` - // The security groups to use for this bare metal server network interface. If unspecified, the VPC's default security - // group is used. + // The resource group to use for this virtual network interface. If unspecified, the + // bare metal server's resource group will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The security groups to use for this virtual network interface. If unspecified, the default security group of the VPC + // for the subnet is used. SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` - // The associated subnet. - Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` + // The associated subnet. Required if `primary_ip` does not specify a reserved IP + // identity. + Subnet SubnetIdentityIntf `json:"subnet,omitempty"` + + // The unique identifier for this virtual network interface. + ID *string `json:"id,omitempty"` + + // The URL for this virtual network interface. + Href *string `json:"href,omitempty"` + + // The CRN for this virtual network interface. + CRN *string `json:"crn,omitempty"` } -// Constants associated with the BareMetalServerPrimaryNetworkInterfacePrototype.InterfaceType property. -// The interface type: -// - `hipersocket`: a virtual device that provides high-speed TCP/IP connectivity -// within a `s390x` based system. -// - Not supported on bare metal servers with a `cpu.architecture` of `amd64` -// - `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 tag. -// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. -const ( - BareMetalServerPrimaryNetworkInterfacePrototypeInterfaceTypeHipersocketConst = "hipersocket" - BareMetalServerPrimaryNetworkInterfacePrototypeInterfaceTypePciConst = "pci" -) +func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} -// NewBareMetalServerPrimaryNetworkInterfacePrototype : Instantiate BareMetalServerPrimaryNetworkInterfacePrototype (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerPrimaryNetworkInterfacePrototype(subnet SubnetIdentityIntf) (_model *BareMetalServerPrimaryNetworkInterfacePrototype, err error) { - _model = &BareMetalServerPrimaryNetworkInterfacePrototype{ - Subnet: subnet, - } - err = core.ValidateStruct(_model, "required parameters") - return +type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf interface { + isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool } -// UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype unmarshals an instance of BareMetalServerPrimaryNetworkInterfacePrototype from the specified map of raw messages. -func UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerPrimaryNetworkInterfacePrototype) +// UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) if err != nil { return } - err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) if err != nil { return } @@ -27563,7 +28953,7 @@ func UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype(m map[string]json. if err != nil { return } - err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPPrototype) if err != nil { return } @@ -27571,94 +28961,23 @@ func UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype(m map[string]json. if err != nil { return } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalNetworkInterfaceIPPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfile : BareMetalServerProfile struct -type BareMetalServerProfile struct { - Bandwidth BareMetalServerProfileBandwidthIntf `json:"bandwidth" validate:"required"` - - // The console type configuration for a bare metal server with this profile. - ConsoleTypes *BareMetalServerProfileConsoleTypes `json:"console_types" validate:"required"` - - CpuArchitecture *BareMetalServerProfileCpuArchitecture `json:"cpu_architecture" validate:"required"` - - CpuCoreCount BareMetalServerProfileCpuCoreCountIntf `json:"cpu_core_count" validate:"required"` - - CpuSocketCount BareMetalServerProfileCpuSocketCountIntf `json:"cpu_socket_count" validate:"required"` - - // Collection of the bare metal server profile's disks. - Disks []BareMetalServerProfileDisk `json:"disks" validate:"required"` - - // The product family this bare metal server profile belongs to. - Family *string `json:"family" validate:"required"` - - // The URL for this bare metal server profile. - Href *string `json:"href" validate:"required"` - - Memory BareMetalServerProfileMemoryIntf `json:"memory" validate:"required"` - - // The name for this bare metal server profile. - Name *string `json:"name" validate:"required"` - - NetworkInterfaceCount BareMetalServerProfileNetworkInterfaceCountIntf `json:"network_interface_count" validate:"required"` - - OsArchitecture *BareMetalServerProfileOsArchitecture `json:"os_architecture" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The supported trusted platform module modes for this bare metal server profile. - SupportedTrustedPlatformModuleModes *BareMetalServerProfileSupportedTrustedPlatformModuleModes `json:"supported_trusted_platform_module_modes" validate:"required"` -} - -// Constants associated with the BareMetalServerProfile.ResourceType property. -// The resource type. -const ( - BareMetalServerProfileResourceTypeBareMetalServerProfileConst = "bare_metal_server_profile" -) - -// UnmarshalBareMetalServerProfile unmarshals an instance of BareMetalServerProfile from the specified map of raw messages. -func UnmarshalBareMetalServerProfile(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfile) - err = core.UnmarshalModel(m, "bandwidth", &obj.Bandwidth, UnmarshalBareMetalServerProfileBandwidth) - if err != nil { - return - } - err = core.UnmarshalModel(m, "console_types", &obj.ConsoleTypes, UnmarshalBareMetalServerProfileConsoleTypes) - if err != nil { - return - } - err = core.UnmarshalModel(m, "cpu_architecture", &obj.CpuArchitecture, UnmarshalBareMetalServerProfileCpuArchitecture) + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPPrototype) if err != nil { return } - err = core.UnmarshalModel(m, "cpu_core_count", &obj.CpuCoreCount, UnmarshalBareMetalServerProfileCpuCoreCount) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return } - err = core.UnmarshalModel(m, "cpu_socket_count", &obj.CpuSocketCount, UnmarshalBareMetalServerProfileCpuSocketCount) + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) if err != nil { return } - err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalBareMetalServerProfileDisk) + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) if err != nil { return } - err = core.UnmarshalPrimitive(m, "family", &obj.Family) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } @@ -27666,27 +28985,7 @@ func UnmarshalBareMetalServerProfile(m map[string]json.RawMessage, result interf if err != nil { return } - err = core.UnmarshalModel(m, "memory", &obj.Memory, UnmarshalBareMetalServerProfileMemory) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_interface_count", &obj.NetworkInterfaceCount, UnmarshalBareMetalServerProfileNetworkInterfaceCount) - if err != nil { - return - } - err = core.UnmarshalModel(m, "os_architecture", &obj.OsArchitecture, UnmarshalBareMetalServerProfileOsArchitecture) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalModel(m, "supported_trusted_platform_module_modes", &obj.SupportedTrustedPlatformModuleModes, UnmarshalBareMetalServerProfileSupportedTrustedPlatformModuleModes) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } @@ -27694,77 +28993,68 @@ func UnmarshalBareMetalServerProfile(m map[string]json.RawMessage, result interf return } -// BareMetalServerProfileBandwidth : BareMetalServerProfileBandwidth struct -// Models which "extend" this model: -// - BareMetalServerProfileBandwidthFixed -// - BareMetalServerProfileBandwidthRange -// - BareMetalServerProfileBandwidthEnum -// - BareMetalServerProfileBandwidthDependent -type BareMetalServerProfileBandwidth struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` +// BareMetalServerNetworkAttachmentReference : BareMetalServerNetworkAttachmentReference struct +type BareMetalServerNetworkAttachmentReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *BareMetalServerNetworkAttachmentReferenceDeleted `json:"deleted,omitempty"` - // The value for this profile field. - Value *int64 `json:"value,omitempty"` + // The URL for this bare metal server network attachment. + Href *string `json:"href" validate:"required"` - // The default value for this profile field. - Default *int64 `json:"default,omitempty"` + // The unique identifier for this bare metal server network attachment. + ID *string `json:"id" validate:"required"` - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` + // The name for this bare metal server network attachment. The name is unique across all network attachments for the + // bare metal server. + Name *string `json:"name" validate:"required"` - // The minimum value for this profile field. - Min *int64 `json:"min,omitempty"` + // The primary IP address of the virtual network interface for the bare metal server + // network attachment. + PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` - // The increment step value for this profile field. - Step *int64 `json:"step,omitempty"` + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` - // The permitted values for this profile field. - Values []int64 `json:"values,omitempty"` + // The subnet of the virtual network interface for the bare metal server network + // attachment. + Subnet *SubnetReference `json:"subnet" validate:"required"` } -// Constants associated with the BareMetalServerProfileBandwidth.Type property. -// The type for this profile field. +// Constants associated with the BareMetalServerNetworkAttachmentReference.ResourceType property. +// The resource type. const ( - BareMetalServerProfileBandwidthTypeFixedConst = "fixed" + BareMetalServerNetworkAttachmentReferenceResourceTypeBareMetalServerNetworkAttachmentConst = "bare_metal_server_network_attachment" ) -func (*BareMetalServerProfileBandwidth) isaBareMetalServerProfileBandwidth() bool { - return true -} - -type BareMetalServerProfileBandwidthIntf interface { - isaBareMetalServerProfileBandwidth() bool -} - -// UnmarshalBareMetalServerProfileBandwidth unmarshals an instance of BareMetalServerProfileBandwidth from the specified map of raw messages. -func UnmarshalBareMetalServerProfileBandwidth(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileBandwidth) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) +// UnmarshalBareMetalServerNetworkAttachmentReference unmarshals an instance of BareMetalServerNetworkAttachmentReference from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerNetworkAttachmentReferenceDeleted) if err != nil { return } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) if err != nil { return } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { return } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) if err != nil { return } @@ -27772,36 +29062,17 @@ func UnmarshalBareMetalServerProfileBandwidth(m map[string]json.RawMessage, resu return } -// BareMetalServerProfileCpuArchitecture : BareMetalServerProfileCpuArchitecture struct -type BareMetalServerProfileCpuArchitecture struct { - // The default CPU architecture for a bare metal server with this profile. - Default *string `json:"default,omitempty"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The CPU architecture for a bare metal server with this profile. - Value *string `json:"value" validate:"required"` +// BareMetalServerNetworkAttachmentReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type BareMetalServerNetworkAttachmentReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` } -// Constants associated with the BareMetalServerProfileCpuArchitecture.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileCpuArchitectureTypeFixedConst = "fixed" -) - -// UnmarshalBareMetalServerProfileCpuArchitecture unmarshals an instance of BareMetalServerProfileCpuArchitecture from the specified map of raw messages. -func UnmarshalBareMetalServerProfileCpuArchitecture(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileCpuArchitecture) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) +// UnmarshalBareMetalServerNetworkAttachmentReferenceDeleted unmarshals an instance of BareMetalServerNetworkAttachmentReferenceDeleted from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) if err != nil { return } @@ -27809,185 +29080,293 @@ func UnmarshalBareMetalServerProfileCpuArchitecture(m map[string]json.RawMessage return } -// BareMetalServerProfileCpuCoreCount : BareMetalServerProfileCpuCoreCount struct +// BareMetalServerNetworkInterface : BareMetalServerNetworkInterface struct // Models which "extend" this model: -// - BareMetalServerProfileCpuCoreCountFixed -// - BareMetalServerProfileCpuCoreCountRange -// - BareMetalServerProfileCpuCoreCountEnum -// - BareMetalServerProfileCpuCoreCountDependent -type BareMetalServerProfileCpuCoreCount struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` +// - BareMetalServerNetworkInterfaceByHiperSocket +// - BareMetalServerNetworkInterfaceByPci +// - BareMetalServerNetworkInterfaceByVlan +type BareMetalServerNetworkInterface struct { + // Indicates whether source IP spoofing is allowed on this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and source IP spoofing is managed on the attached virtual + // network interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"` - // The value for this profile field. - Value *int64 `json:"value,omitempty"` + // The date and time that the bare metal server network interface was created. + // + // If this bare metal server has network attachments, this network interface was created as a [read-only + // representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) when its corresponding network attachment + // was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - // The default value for this profile field. - Default *int64 `json:"default,omitempty"` + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - `floating_ips` must not have more than one floating IP. + // + // If `false`: + // - Packets are passed unchanged to/from the bare metal server network interface, + // allowing the workload to perform any needed NAT operations. + // - `allow_ip_spoofing` must be `false`. + // - `interface_type` must not be `hipersocket`. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and infrastructure NAT is managed on the attached virtual + // network interface. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` + // The floating IPs associated with this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the floating IPs are associated with the attached virtual + // network interface. + FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` - // The minimum value for this profile field. - Min *int64 `json:"min,omitempty"` + // The URL for this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. + Href *string `json:"href" validate:"required"` - // The increment step value for this profile field. - Step *int64 `json:"step,omitempty"` + // The unique identifier for this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the identifier is that of the corresponding network + // attachment. + ID *string `json:"id" validate:"required"` - // The permitted values for this profile field. - Values []int64 `json:"values,omitempty"` -} + // The interface type: + // - `hipersocket`: a virtual device that provides high-speed TCP/IP connectivity + // within a `s390x` based system + // - `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 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. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the interface type is that of the corresponding network + // attachment. + // + // 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"` -// Constants associated with the BareMetalServerProfileCpuCoreCount.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileCpuCoreCountTypeFixedConst = "fixed" -) + // The MAC address of this bare metal server network interface. If the MAC address has not yet been selected, the value + // will be an empty string. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the MAC address is that of the attached virtual network + // interface. + MacAddress *string `json:"mac_address" validate:"required"` -func (*BareMetalServerProfileCpuCoreCount) isaBareMetalServerProfileCpuCoreCount() bool { - return true -} + // The name for this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the name matches its corresponding network attachment. + Name *string `json:"name" validate:"required"` -type BareMetalServerProfileCpuCoreCountIntf interface { - isaBareMetalServerProfileCpuCoreCount() bool -} + // The bare metal server network interface port speed in Mbps. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the port speed is that of its corresponding network + // attachment. + PortSpeed *int64 `json:"port_speed" validate:"required"` -// UnmarshalBareMetalServerProfileCpuCoreCount unmarshals an instance of BareMetalServerProfileCpuCoreCount from the specified map of raw messages. -func UnmarshalBareMetalServerProfileCpuCoreCount(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileCpuCoreCount) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} + PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` -// BareMetalServerProfileCpuSocketCount : BareMetalServerProfileCpuSocketCount struct -// Models which "extend" this model: -// - BareMetalServerProfileCpuSocketCountFixed -// - BareMetalServerProfileCpuSocketCountRange -// - BareMetalServerProfileCpuSocketCountEnum -// - BareMetalServerProfileCpuSocketCountDependent -type BareMetalServerProfileCpuSocketCount struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` - // The value for this profile field. - Value *int64 `json:"value,omitempty"` + // The security groups targeting this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the security groups are associated with the attached + // virtual network interface. + SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` - // The default value for this profile field. - Default *int64 `json:"default,omitempty"` + // The status of the bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a read-only representation of its + // corresponding network attachment and its attached virtual network interface, and the status is [computed from + // them](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients). + Status *string `json:"status" validate:"required"` - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` + // The associated subnet. + Subnet *SubnetReference `json:"subnet" validate:"required"` - // The minimum value for this profile field. - Min *int64 `json:"min,omitempty"` + // The bare metal server network interface type. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the type is that of its corresponding network attachment. + Type *string `json:"type" validate:"required"` - // The increment step value for this profile field. - Step *int64 `json:"step,omitempty"` + // The VLAN IDs allowed for `vlan` interfaces using this PCI interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the VLAN IDs match the `allow_vlans` of the corresponding + // network attachment. + AllowedVlans []int64 `json:"allowed_vlans,omitempty"` - // The permitted values for this profile field. - Values []int64 `json:"values,omitempty"` + // Indicates if the data path for the network interface can float to another bare metal server. Can only be `true` for + // network interfaces with an `interface_type` of `vlan`. + // + // If `true`, and the network detects traffic for this data path on another bare metal server in the resource group, + // the network interface will be automatically deleted from this bare metal server and a new network interface with the + // same `id`, `name` and `vlan` will be created on the other bare metal server. + // + // For the data path to float, the other bare metal server must be in the same + // `resource_group`, and must have a network interface with `interface_type` of `pci` with `allowed_vlans` including + // this network interface's `vlan`. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the value of this property matches that of the + // `allow_to_float` property of the corresponding network attachment. + AllowInterfaceToFloat *bool `json:"allow_interface_to_float,omitempty"` + + // The VLAN ID used in the IEEE 802.1Q tag present in all traffic on this interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the VLAN ID matches the `vlan` of the corresponding + // network attachment. + Vlan *int64 `json:"vlan,omitempty"` } -// Constants associated with the BareMetalServerProfileCpuSocketCount.Type property. -// The type for this profile field. +// Constants associated with the BareMetalServerNetworkInterface.InterfaceType property. +// The interface type: +// - `hipersocket`: a virtual device that provides high-speed TCP/IP connectivity +// within a `s390x` based system +// - `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 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. +// +// If this bare metal server has network attachments, this network interface is a +// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network +// attachment and its attached virtual network interface, and the interface type is that of the corresponding network +// attachment. +// +// 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 ( - BareMetalServerProfileCpuSocketCountTypeFixedConst = "fixed" + BareMetalServerNetworkInterfaceInterfaceTypeHipersocketConst = "hipersocket" + BareMetalServerNetworkInterfaceInterfaceTypePciConst = "pci" + BareMetalServerNetworkInterfaceInterfaceTypeVlanConst = "vlan" ) -func (*BareMetalServerProfileCpuSocketCount) isaBareMetalServerProfileCpuSocketCount() 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 bare metal server network interface. +// +// If this bare metal server has network attachments, this network interface is a read-only representation of its +// corresponding network attachment and its attached virtual network interface, and the status is [computed from +// them](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients). +const ( + BareMetalServerNetworkInterfaceStatusAvailableConst = "available" + BareMetalServerNetworkInterfaceStatusDeletingConst = "deleting" + BareMetalServerNetworkInterfaceStatusFailedConst = "failed" + BareMetalServerNetworkInterfaceStatusPendingConst = "pending" +) + +// Constants associated with the BareMetalServerNetworkInterface.Type property. +// The bare metal server network interface type. +// +// If this bare metal server has network attachments, this network interface is a +// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network +// attachment and its attached virtual network interface, and the type is that of its corresponding network attachment. +const ( + BareMetalServerNetworkInterfaceTypePrimaryConst = "primary" + BareMetalServerNetworkInterfaceTypeSecondaryConst = "secondary" +) + +func (*BareMetalServerNetworkInterface) isaBareMetalServerNetworkInterface() bool { return true } -type BareMetalServerProfileCpuSocketCountIntf interface { - isaBareMetalServerProfileCpuSocketCount() bool +type BareMetalServerNetworkInterfaceIntf interface { + isaBareMetalServerNetworkInterface() bool } -// UnmarshalBareMetalServerProfileCpuSocketCount unmarshals an instance of BareMetalServerProfileCpuSocketCount from the specified map of raw messages. -func UnmarshalBareMetalServerProfileCpuSocketCount(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileCpuSocketCount) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) +// 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) if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'interface_type': %s", err.Error()) return } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { + if discValue == "" { + err = fmt.Errorf("required discriminator property 'interface_type' not found in JSON object") return } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return + if discValue == "hipersocket" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfaceByHiperSocket) + } else 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) } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerProfileCollection : BareMetalServerProfileCollection struct -type BareMetalServerProfileCollection struct { +// BareMetalServerNetworkInterfaceCollection : BareMetalServerNetworkInterfaceCollection struct +type BareMetalServerNetworkInterfaceCollection struct { // A link to the first page of resources. - First *BareMetalServerProfileCollectionFirst `json:"first" validate:"required"` + 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 bare metal server 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 *BareMetalServerProfileCollectionNext `json:"next,omitempty"` - - // Collection of bare metal server profiles. - Profiles []BareMetalServerProfile `json:"profiles" validate:"required"` + Next *BareMetalServerNetworkInterfaceCollectionNext `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` } -// UnmarshalBareMetalServerProfileCollection unmarshals an instance of BareMetalServerProfileCollection from the specified map of raw messages. -func UnmarshalBareMetalServerProfileCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBareMetalServerProfileCollectionFirst) +// 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 } @@ -27995,11 +29374,11 @@ func UnmarshalBareMetalServerProfileCollection(m map[string]json.RawMessage, res if err != nil { return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerProfileCollectionNext) + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalBareMetalServerNetworkInterface) if err != nil { return } - err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalBareMetalServerProfile) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerNetworkInterfaceCollectionNext) if err != nil { return } @@ -28012,7 +29391,7 @@ func UnmarshalBareMetalServerProfileCollection(m map[string]json.RawMessage, res } // Retrieve the value to be passed to a request to access the next page of results -func (resp *BareMetalServerProfileCollection) GetNextStart() (*string, error) { +func (resp *BareMetalServerNetworkInterfaceCollection) GetNextStart() (*string, error) { if core.IsNil(resp.Next) { return nil, nil } @@ -28023,15 +29402,15 @@ func (resp *BareMetalServerProfileCollection) GetNextStart() (*string, error) { return start, nil } -// BareMetalServerProfileCollectionFirst : A link to the first page of resources. -type BareMetalServerProfileCollectionFirst struct { +// 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"` } -// UnmarshalBareMetalServerProfileCollectionFirst unmarshals an instance of BareMetalServerProfileCollectionFirst from the specified map of raw messages. -func UnmarshalBareMetalServerProfileCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileCollectionFirst) +// 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 @@ -28040,15 +29419,15 @@ func UnmarshalBareMetalServerProfileCollectionFirst(m map[string]json.RawMessage return } -// BareMetalServerProfileCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type BareMetalServerProfileCollectionNext 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"` } -// UnmarshalBareMetalServerProfileCollectionNext unmarshals an instance of BareMetalServerProfileCollectionNext from the specified map of raw messages. -func UnmarshalBareMetalServerProfileCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileCollectionNext) +// 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 @@ -28057,64 +29436,57 @@ func UnmarshalBareMetalServerProfileCollectionNext(m map[string]json.RawMessage, return } -// BareMetalServerProfileConsoleTypes : The console type configuration for a bare metal server with this profile. -type BareMetalServerProfileConsoleTypes struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` +// BareMetalServerNetworkInterfacePatch : BareMetalServerNetworkInterfacePatch struct +type BareMetalServerNetworkInterfacePatch struct { + // Indicates whether source IP spoofing is allowed on this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and source IP spoofing is managed on the attached virtual + // network interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` - // The console types for a bare metal server with this profile. - Values []string `json:"values" validate:"required"` -} + // The VLAN IDs to allow for `vlan` interfaces using this PCI interface, replacing any existing VLAN IDs. The specified + // values must include IDs for all `vlan` interfaces currently using this PCI interface. + AllowedVlans []int64 `json:"allowed_vlans,omitempty"` -// Constants associated with the BareMetalServerProfileConsoleTypes.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileConsoleTypesTypeEnumConst = "enum" -) + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - `floating_ips` must not have more than one floating IP. + // + // If `false`: + // - Packets are passed unchanged to/from the bare metal server network interface, + // allowing the workload to perform any needed NAT operations. + // - `allow_ip_spoofing` must be `false`. + // - `interface_type` must not be `hipersocket`. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and infrastructure NAT is managed on the attached virtual + // network interface. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` -// Constants associated with the BareMetalServerProfileConsoleTypes.Values property. -// A console type. -const ( - BareMetalServerProfileConsoleTypesValuesSerialConst = "serial" - BareMetalServerProfileConsoleTypesValuesVncConst = "vnc" -) + // The name for this bare metal server network interface. The name must not be used by another network interface on the + // bare metal server. + Name *string `json:"name,omitempty"` +} -// UnmarshalBareMetalServerProfileConsoleTypes unmarshals an instance of BareMetalServerProfileConsoleTypes from the specified map of raw messages. -func UnmarshalBareMetalServerProfileConsoleTypes(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileConsoleTypes) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) +// 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 } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileDisk : Disks provided by this profile. -type BareMetalServerProfileDisk struct { - Quantity BareMetalServerProfileDiskQuantityIntf `json:"quantity" validate:"required"` - - Size BareMetalServerProfileDiskSizeIntf `json:"size" validate:"required"` - - SupportedInterfaceTypes *BareMetalServerProfileDiskSupportedInterfaces `json:"supported_interface_types" validate:"required"` -} - -// UnmarshalBareMetalServerProfileDisk unmarshals an instance of BareMetalServerProfileDisk from the specified map of raw messages. -func UnmarshalBareMetalServerProfileDisk(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileDisk) - err = core.UnmarshalModel(m, "quantity", &obj.Quantity, UnmarshalBareMetalServerProfileDiskQuantity) + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) if err != nil { return } - err = core.UnmarshalModel(m, "size", &obj.Size, UnmarshalBareMetalServerProfileDiskSize) + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) if err != nil { return } - err = core.UnmarshalModel(m, "supported_interface_types", &obj.SupportedInterfaceTypes, UnmarshalBareMetalServerProfileDiskSupportedInterfaces) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } @@ -28122,77 +29494,232 @@ func UnmarshalBareMetalServerProfileDisk(m map[string]json.RawMessage, result in return } -// BareMetalServerProfileDiskQuantity : BareMetalServerProfileDiskQuantity struct +// 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: -// - BareMetalServerProfileDiskQuantityFixed -// - BareMetalServerProfileDiskQuantityRange -// - BareMetalServerProfileDiskQuantityEnum -// - BareMetalServerProfileDiskQuantityDependent -type BareMetalServerProfileDiskQuantity struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` +// - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype +// - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype +// - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype +type BareMetalServerNetworkInterfacePrototype struct { + // Indicates whether source IP spoofing is allowed on this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and source IP spoofing is managed on the attached virtual + // network interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` - // The value for this profile field. - Value *int64 `json:"value,omitempty"` + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - `floating_ips` must not have more than one floating IP. + // + // If `false`: + // - Packets are passed unchanged to/from the bare metal server network interface, + // allowing the workload to perform any needed NAT operations. + // - `allow_ip_spoofing` must be `false`. + // - `interface_type` must not be `hipersocket`. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and infrastructure NAT is managed on the attached virtual + // network interface. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` - // The default value for this profile field. - Default *int64 `json:"default,omitempty"` + // The interface type: + // - `hipersocket`: a virtual device that provides high-speed TCP/IP connectivity + // within a `s390x` based system + // - Not supported on bare metal servers with a `cpu.architecture` of `amd64` + // - `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 tag. + // - Not supported on bare metal servers with a `cpu.architecture` of `s390x` + // - `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. + // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. + InterfaceType *string `json:"interface_type" validate:"required"` - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` + // The name for this bare metal server network interface. The name must not be used by another network interface on the + // bare metal server. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` - // The minimum value for this profile field. - Min *int64 `json:"min,omitempty"` + // The primary IP address to bind to the bare metal server 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 bare metal server network interface's subnet. Otherwise, an + // available address on the subnet will be automatically selected and reserved. + PrimaryIP NetworkInterfaceIPPrototypeIntf `json:"primary_ip,omitempty"` - // The increment step value for this profile field. - Step *int64 `json:"step,omitempty"` + // The security groups to use for this bare metal server network interface. If unspecified, the VPC's default security + // group is used. + SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` - // The permitted values for this profile field. - Values []int64 `json:"values,omitempty"` + // The associated subnet. + Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` + + // The VLAN IDs to allow for `vlan` interfaces using this PCI interface. + AllowedVlans []int64 `json:"allowed_vlans,omitempty"` + + // Indicates if the data path for the network interface can float to another bare metal server. Can only be `true` for + // network interfaces with an `interface_type` of `vlan`. + // + // If `true`, and the network detects traffic for this data path on another bare metal server in the resource group, + // the network interface will be automatically deleted from this bare metal server and a new network interface with the + // same `id`, `name` and `vlan` will be created on the other bare metal server. + // + // For the data path to float, the other bare metal server must be in the same + // `resource_group`, and must have a network interface with `interface_type` of `pci` with `allowed_vlans` including + // this network interface's `vlan`. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the value of this property matches that of the + // `allow_to_float` property of the corresponding network attachment. + AllowInterfaceToFloat *bool `json:"allow_interface_to_float,omitempty"` + + // The VLAN ID used in the IEEE 802.1Q tag present in all traffic on this interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the VLAN ID matches the `vlan` of the corresponding + // network attachment. + Vlan *int64 `json:"vlan,omitempty"` } -// Constants associated with the BareMetalServerProfileDiskQuantity.Type property. -// The type for this profile field. +// Constants associated with the BareMetalServerNetworkInterfacePrototype.InterfaceType property. +// The interface type: +// - `hipersocket`: a virtual device that provides high-speed TCP/IP connectivity +// within a `s390x` based system +// - Not supported on bare metal servers with a `cpu.architecture` of `amd64` +// - `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 tag. +// - Not supported on bare metal servers with a `cpu.architecture` of `s390x` +// - `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. +// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. const ( - BareMetalServerProfileDiskQuantityTypeFixedConst = "fixed" + BareMetalServerNetworkInterfacePrototypeInterfaceTypeHipersocketConst = "hipersocket" + BareMetalServerNetworkInterfacePrototypeInterfaceTypePciConst = "pci" + BareMetalServerNetworkInterfacePrototypeInterfaceTypeVlanConst = "vlan" ) -func (*BareMetalServerProfileDiskQuantity) isaBareMetalServerProfileDiskQuantity() bool { +func (*BareMetalServerNetworkInterfacePrototype) isaBareMetalServerNetworkInterfacePrototype() bool { return true } -type BareMetalServerProfileDiskQuantityIntf interface { - isaBareMetalServerProfileDiskQuantity() bool +type BareMetalServerNetworkInterfacePrototypeIntf interface { + isaBareMetalServerNetworkInterfacePrototype() bool } -// UnmarshalBareMetalServerProfileDiskQuantity unmarshals an instance of BareMetalServerProfileDiskQuantity from the specified map of raw messages. -func UnmarshalBareMetalServerProfileDiskQuantity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileDiskQuantity) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) +// 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 } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { + if discValue == "" { + err = fmt.Errorf("required discriminator property 'interface_type' not found in JSON object") return } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if discValue == "hipersocket" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) + } else 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 +} + +// BareMetalServerNetworkInterfaceReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type BareMetalServerNetworkInterfaceReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalBareMetalServerNetworkInterfaceReferenceDeleted unmarshals an instance of BareMetalServerNetworkInterfaceReferenceDeleted from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfaceReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfaceReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) if err != nil { return } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkInterfaceReferenceTargetContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type BareMetalServerNetworkInterfaceReferenceTargetContextDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalBareMetalServerNetworkInterfaceReferenceTargetContextDeleted unmarshals an instance of BareMetalServerNetworkInterfaceReferenceTargetContextDeleted from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfaceReferenceTargetContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfaceReferenceTargetContextDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) if err != nil { return } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerPatch : BareMetalServerPatch struct +type BareMetalServerPatch struct { + // Indicates whether secure boot is enabled. If enabled, the image must support secure boot or the bare metal server + // will fail to boot. + // + // For `enable_secure_boot` to be changed, the bare metal server `status` must be + // `stopped`. + EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + + // The name for this bare metal server. The name must not be used by another bare metal server in the region. Changing + // the name will not affect the system hostname. + Name *string `json:"name,omitempty"` + + TrustedPlatformModule *BareMetalServerTrustedPlatformModulePatch `json:"trusted_platform_module,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, "enable_secure_boot", &obj.EnableSecureBoot) if err != nil { return } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) + err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePatch) if err != nil { return } @@ -28200,77 +29727,81 @@ func UnmarshalBareMetalServerProfileDiskQuantity(m map[string]json.RawMessage, r return } -// BareMetalServerProfileDiskSize : BareMetalServerProfileDiskSize struct -// Models which "extend" this model: -// - BareMetalServerProfileDiskSizeFixed -// - BareMetalServerProfileDiskSizeRange -// - BareMetalServerProfileDiskSizeEnum -// - BareMetalServerProfileDiskSizeDependent -type BareMetalServerProfileDiskSize struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` - - // The value for this profile field. - Value *int64 `json:"value,omitempty"` - - // The default value for this profile field. - Default *int64 `json:"default,omitempty"` +// 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 +} - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` +// BareMetalServerPrimaryNetworkAttachmentPrototype : BareMetalServerPrimaryNetworkAttachmentPrototype struct +// Models which "extend" this model: +// - BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype +type BareMetalServerPrimaryNetworkAttachmentPrototype struct { + // The network attachment's 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 attachment + // - Cannot directly use an IEEE 802.1Q tag. + // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. + InterfaceType *string `json:"interface_type,omitempty"` - // The minimum value for this profile field. - Min *int64 `json:"min,omitempty"` + // The name for this bare metal server network attachment. Names must be unique within the bare metal server the + // network attachment resides in. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` - // The increment step value for this profile field. - Step *int64 `json:"step,omitempty"` + // A virtual network interface for the bare metal server network attachment. This can be + // specified using an existing virtual network interface, or a prototype object for a new + // virtual network interface. + // + // If an existing virtual network interface is specified, it must not be the target of a flow + // log collector. + VirtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf `json:"virtual_network_interface" validate:"required"` - // The permitted values for this profile field. - Values []int64 `json:"values,omitempty"` + // The VLAN IDs to allow for `vlan` attachments using this PCI attachment. + AllowedVlans []int64 `json:"allowed_vlans,omitempty"` } -// Constants associated with the BareMetalServerProfileDiskSize.Type property. -// The type for this profile field. +// Constants associated with the BareMetalServerPrimaryNetworkAttachmentPrototype.InterfaceType property. +// The network attachment's 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 attachment +// - Cannot directly use an IEEE 802.1Q tag. +// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. const ( - BareMetalServerProfileDiskSizeTypeFixedConst = "fixed" + BareMetalServerPrimaryNetworkAttachmentPrototypeInterfaceTypePciConst = "pci" ) -func (*BareMetalServerProfileDiskSize) isaBareMetalServerProfileDiskSize() bool { +func (*BareMetalServerPrimaryNetworkAttachmentPrototype) isaBareMetalServerPrimaryNetworkAttachmentPrototype() bool { return true } -type BareMetalServerProfileDiskSizeIntf interface { - isaBareMetalServerProfileDiskSize() bool +type BareMetalServerPrimaryNetworkAttachmentPrototypeIntf interface { + isaBareMetalServerPrimaryNetworkAttachmentPrototype() bool } -// UnmarshalBareMetalServerProfileDiskSize unmarshals an instance of BareMetalServerProfileDiskSize from the specified map of raw messages. -func UnmarshalBareMetalServerProfileDiskSize(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileDiskSize) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) +// UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototype unmarshals an instance of BareMetalServerPrimaryNetworkAttachmentPrototype from the specified map of raw messages. +func UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerPrimaryNetworkAttachmentPrototype) + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) if err != nil { return } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) if err != nil { return } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) if err != nil { return } @@ -28278,76 +29809,129 @@ func UnmarshalBareMetalServerProfileDiskSize(m map[string]json.RawMessage, resul return } -// BareMetalServerProfileDiskSupportedInterfaces : BareMetalServerProfileDiskSupportedInterfaces struct -type BareMetalServerProfileDiskSupportedInterfaces struct { - // The disk interface used for attaching the disk. +// BareMetalServerPrimaryNetworkInterfacePrototype : BareMetalServerPrimaryNetworkInterfacePrototype struct +type BareMetalServerPrimaryNetworkInterfacePrototype struct { + // Indicates whether source IP spoofing is allowed on this bare metal server network interface. // - // - `fcp`: Attached using Fiber Channel Protocol - // - `sata`: Attached using Serial Advanced Technology Attachment - // - `nvme`: Attached using Non-Volatile Memory Express + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and source IP spoofing is managed on the attached virtual + // network interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` + + // The VLAN IDs allowed for `vlan` interfaces using this PCI interface. // - // 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. - Default *string `json:"default" validate:"required"` + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the VLAN IDs match the `allow_vlans` of the corresponding + // network attachment. + AllowedVlans []int64 `json:"allowed_vlans,omitempty"` - // The type for this profile field. - Type *string `json:"type" validate:"required"` + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - `floating_ips` must not have more than one floating IP. + // + // If `false`: + // - Packets are passed unchanged to/from the bare metal server network interface, + // allowing the workload to perform any needed NAT operations. + // - `allow_ip_spoofing` must be `false`. + // - `interface_type` must not be `hipersocket`. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and infrastructure NAT is managed on the attached virtual + // network interface. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` - // The supported disk interfaces used for attaching the disk. - Values []string `json:"values" validate:"required"` -} + // The interface type: + // - `hipersocket`: a virtual device that provides high-speed TCP/IP connectivity + // within a `s390x` based system. + // - Not supported on bare metal servers with a `cpu.architecture` of `amd64` + // - `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 tag. + // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. + InterfaceType *string `json:"interface_type,omitempty"` -// Constants associated with the BareMetalServerProfileDiskSupportedInterfaces.Default property. -// The disk interface used for attaching the disk. -// -// - `fcp`: Attached using Fiber Channel Protocol -// - `sata`: Attached using Serial Advanced Technology Attachment -// - `nvme`: Attached using Non-Volatile Memory Express -// -// 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 ( - BareMetalServerProfileDiskSupportedInterfacesDefaultFcpConst = "fcp" - BareMetalServerProfileDiskSupportedInterfacesDefaultNvmeConst = "nvme" - BareMetalServerProfileDiskSupportedInterfacesDefaultSataConst = "sata" -) + // The name for this bare metal server network interface. The name must not be used by another network interface on the + // bare metal server. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` -// Constants associated with the BareMetalServerProfileDiskSupportedInterfaces.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileDiskSupportedInterfacesTypeEnumConst = "enum" -) + // The primary IP address to bind to the bare metal server 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 bare metal server network interface's subnet. Otherwise, an + // available address on the subnet will be automatically selected and reserved. + PrimaryIP NetworkInterfaceIPPrototypeIntf `json:"primary_ip,omitempty"` -// Constants associated with the BareMetalServerProfileDiskSupportedInterfaces.Values property. -// The disk interface used for attaching the disk. -// -// - `fcp`: Attached using Fiber Channel Protocol -// - `sata`: Attached using Serial Advanced Technology Attachment -// - `nvme`: Attached using Non-Volatile Memory Express -// -// 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. + // The security groups to use for this bare metal server 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"` +} + +// Constants associated with the BareMetalServerPrimaryNetworkInterfacePrototype.InterfaceType property. +// The interface type: +// - `hipersocket`: a virtual device that provides high-speed TCP/IP connectivity +// within a `s390x` based system. +// - Not supported on bare metal servers with a `cpu.architecture` of `amd64` +// - `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 tag. +// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. const ( - BareMetalServerProfileDiskSupportedInterfacesValuesFcpConst = "fcp" - BareMetalServerProfileDiskSupportedInterfacesValuesNvmeConst = "nvme" - BareMetalServerProfileDiskSupportedInterfacesValuesSataConst = "sata" + BareMetalServerPrimaryNetworkInterfacePrototypeInterfaceTypeHipersocketConst = "hipersocket" + BareMetalServerPrimaryNetworkInterfacePrototypeInterfaceTypePciConst = "pci" ) -// UnmarshalBareMetalServerProfileDiskSupportedInterfaces unmarshals an instance of BareMetalServerProfileDiskSupportedInterfaces from the specified map of raw messages. -func UnmarshalBareMetalServerProfileDiskSupportedInterfaces(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileDiskSupportedInterfaces) - err = core.UnmarshalPrimitive(m, "default", &obj.Default) +// NewBareMetalServerPrimaryNetworkInterfacePrototype : Instantiate BareMetalServerPrimaryNetworkInterfacePrototype (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerPrimaryNetworkInterfacePrototype(subnet SubnetIdentityIntf) (_model *BareMetalServerPrimaryNetworkInterfacePrototype, err error) { + _model = &BareMetalServerPrimaryNetworkInterfacePrototype{ + Subnet: subnet, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype unmarshals an instance of BareMetalServerPrimaryNetworkInterfacePrototype from the specified map of raw messages. +func UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerPrimaryNetworkInterfacePrototype) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) if err != nil { return } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) if err != nil { return } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalNetworkInterfaceIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) if err != nil { return } @@ -28355,30 +29939,83 @@ func UnmarshalBareMetalServerProfileDiskSupportedInterfaces(m map[string]json.Ra return } -// BareMetalServerProfileIdentity : Identifies a bare metal server profile by a unique property. -// Models which "extend" this model: -// - BareMetalServerProfileIdentityByName -// - BareMetalServerProfileIdentityByHref -type BareMetalServerProfileIdentity struct { - // The name for this bare metal server profile. - Name *string `json:"name,omitempty"` +// BareMetalServerProfile : BareMetalServerProfile struct +type BareMetalServerProfile struct { + Bandwidth BareMetalServerProfileBandwidthIntf `json:"bandwidth" validate:"required"` + + // The console type configuration for a bare metal server with this profile. + ConsoleTypes *BareMetalServerProfileConsoleTypes `json:"console_types" validate:"required"` + + CpuArchitecture *BareMetalServerProfileCpuArchitecture `json:"cpu_architecture" validate:"required"` + + CpuCoreCount BareMetalServerProfileCpuCoreCountIntf `json:"cpu_core_count" validate:"required"` + + CpuSocketCount BareMetalServerProfileCpuSocketCountIntf `json:"cpu_socket_count" validate:"required"` + + // Collection of the bare metal server profile's disks. + Disks []BareMetalServerProfileDisk `json:"disks" validate:"required"` + + // The product family this bare metal server profile belongs to. + Family *string `json:"family" validate:"required"` // The URL for this bare metal server profile. - Href *string `json:"href,omitempty"` -} + Href *string `json:"href" validate:"required"` -func (*BareMetalServerProfileIdentity) isaBareMetalServerProfileIdentity() bool { - return true -} + Memory BareMetalServerProfileMemoryIntf `json:"memory" validate:"required"` -type BareMetalServerProfileIdentityIntf interface { - isaBareMetalServerProfileIdentity() bool + // The name for this bare metal server profile. + Name *string `json:"name" validate:"required"` + + NetworkAttachmentCount BareMetalServerProfileNetworkAttachmentCountIntf `json:"network_attachment_count" validate:"required"` + + NetworkInterfaceCount BareMetalServerProfileNetworkInterfaceCountIntf `json:"network_interface_count" validate:"required"` + + OsArchitecture *BareMetalServerProfileOsArchitecture `json:"os_architecture" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The supported trusted platform module modes for this bare metal server profile. + SupportedTrustedPlatformModuleModes *BareMetalServerProfileSupportedTrustedPlatformModuleModes `json:"supported_trusted_platform_module_modes" validate:"required"` + + // Indicates whether this profile supports virtual network interfaces. + VirtualNetworkInterfacesSupported *BareMetalServerProfileVirtualNetworkInterfacesSupported `json:"virtual_network_interfaces_supported" validate:"required"` } -// UnmarshalBareMetalServerProfileIdentity unmarshals an instance of BareMetalServerProfileIdentity from the specified map of raw messages. -func UnmarshalBareMetalServerProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileIdentity) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) +// Constants associated with the BareMetalServerProfile.ResourceType property. +// The resource type. +const ( + BareMetalServerProfileResourceTypeBareMetalServerProfileConst = "bare_metal_server_profile" +) + +// UnmarshalBareMetalServerProfile unmarshals an instance of BareMetalServerProfile from the specified map of raw messages. +func UnmarshalBareMetalServerProfile(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfile) + err = core.UnmarshalModel(m, "bandwidth", &obj.Bandwidth, UnmarshalBareMetalServerProfileBandwidth) + if err != nil { + return + } + err = core.UnmarshalModel(m, "console_types", &obj.ConsoleTypes, UnmarshalBareMetalServerProfileConsoleTypes) + if err != nil { + return + } + err = core.UnmarshalModel(m, "cpu_architecture", &obj.CpuArchitecture, UnmarshalBareMetalServerProfileCpuArchitecture) + if err != nil { + return + } + err = core.UnmarshalModel(m, "cpu_core_count", &obj.CpuCoreCount, UnmarshalBareMetalServerProfileCpuCoreCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "cpu_socket_count", &obj.CpuSocketCount, UnmarshalBareMetalServerProfileCpuSocketCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalBareMetalServerProfileDisk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "family", &obj.Family) if err != nil { return } @@ -28386,17 +30023,49 @@ func UnmarshalBareMetalServerProfileIdentity(m map[string]json.RawMessage, resul if err != nil { return } + err = core.UnmarshalModel(m, "memory", &obj.Memory, UnmarshalBareMetalServerProfileMemory) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachment_count", &obj.NetworkAttachmentCount, UnmarshalBareMetalServerProfileNetworkAttachmentCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interface_count", &obj.NetworkInterfaceCount, UnmarshalBareMetalServerProfileNetworkInterfaceCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "os_architecture", &obj.OsArchitecture, UnmarshalBareMetalServerProfileOsArchitecture) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "supported_trusted_platform_module_modes", &obj.SupportedTrustedPlatformModuleModes, UnmarshalBareMetalServerProfileSupportedTrustedPlatformModuleModes) + if err != nil { + return + } + err = core.UnmarshalModel(m, "virtual_network_interfaces_supported", &obj.VirtualNetworkInterfacesSupported, UnmarshalBareMetalServerProfileVirtualNetworkInterfacesSupported) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerProfileMemory : BareMetalServerProfileMemory struct +// BareMetalServerProfileBandwidth : BareMetalServerProfileBandwidth struct // Models which "extend" this model: -// - BareMetalServerProfileMemoryFixed -// - BareMetalServerProfileMemoryRange -// - BareMetalServerProfileMemoryEnum -// - BareMetalServerProfileMemoryDependent -type BareMetalServerProfileMemory struct { +// - BareMetalServerProfileBandwidthFixed +// - BareMetalServerProfileBandwidthRange +// - BareMetalServerProfileBandwidthEnum +// - BareMetalServerProfileBandwidthDependent +type BareMetalServerProfileBandwidth struct { // The type for this profile field. Type *string `json:"type,omitempty"` @@ -28419,23 +30088,23 @@ type BareMetalServerProfileMemory struct { Values []int64 `json:"values,omitempty"` } -// Constants associated with the BareMetalServerProfileMemory.Type property. +// Constants associated with the BareMetalServerProfileBandwidth.Type property. // The type for this profile field. const ( - BareMetalServerProfileMemoryTypeFixedConst = "fixed" + BareMetalServerProfileBandwidthTypeFixedConst = "fixed" ) -func (*BareMetalServerProfileMemory) isaBareMetalServerProfileMemory() bool { +func (*BareMetalServerProfileBandwidth) isaBareMetalServerProfileBandwidth() bool { return true } -type BareMetalServerProfileMemoryIntf interface { - isaBareMetalServerProfileMemory() bool +type BareMetalServerProfileBandwidthIntf interface { + isaBareMetalServerProfileBandwidth() bool } -// UnmarshalBareMetalServerProfileMemory unmarshals an instance of BareMetalServerProfileMemory from the specified map of raw messages. -func UnmarshalBareMetalServerProfileMemory(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileMemory) +// UnmarshalBareMetalServerProfileBandwidth unmarshals an instance of BareMetalServerProfileBandwidth from the specified map of raw messages. +func UnmarshalBareMetalServerProfileBandwidth(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileBandwidth) err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { return @@ -28468,38 +30137,101 @@ func UnmarshalBareMetalServerProfileMemory(m map[string]json.RawMessage, result return } -// BareMetalServerProfileNetworkInterfaceCount : BareMetalServerProfileNetworkInterfaceCount struct +// BareMetalServerProfileCpuArchitecture : BareMetalServerProfileCpuArchitecture struct +type BareMetalServerProfileCpuArchitecture struct { + // The default CPU architecture for a bare metal server with this profile. + Default *string `json:"default,omitempty"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The CPU architecture for a bare metal server with this profile. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileCpuArchitecture.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileCpuArchitectureTypeFixedConst = "fixed" +) + +// UnmarshalBareMetalServerProfileCpuArchitecture unmarshals an instance of BareMetalServerProfileCpuArchitecture from the specified map of raw messages. +func UnmarshalBareMetalServerProfileCpuArchitecture(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileCpuArchitecture) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileCpuCoreCount : BareMetalServerProfileCpuCoreCount struct // Models which "extend" this model: -// - BareMetalServerProfileNetworkInterfaceCountRange -// - BareMetalServerProfileNetworkInterfaceCountDependent -type BareMetalServerProfileNetworkInterfaceCount struct { +// - BareMetalServerProfileCpuCoreCountFixed +// - BareMetalServerProfileCpuCoreCountRange +// - BareMetalServerProfileCpuCoreCountEnum +// - BareMetalServerProfileCpuCoreCountDependent +type BareMetalServerProfileCpuCoreCount struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *int64 `json:"value,omitempty"` + + // The default value for this profile field. + Default *int64 `json:"default,omitempty"` + // The maximum value for this profile field. Max *int64 `json:"max,omitempty"` // The minimum value for this profile field. Min *int64 `json:"min,omitempty"` - // The type for this profile field. - Type *string `json:"type,omitempty"` + // The increment step value for this profile field. + Step *int64 `json:"step,omitempty"` + + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` } -// Constants associated with the BareMetalServerProfileNetworkInterfaceCount.Type property. +// Constants associated with the BareMetalServerProfileCpuCoreCount.Type property. // The type for this profile field. const ( - BareMetalServerProfileNetworkInterfaceCountTypeRangeConst = "range" + BareMetalServerProfileCpuCoreCountTypeFixedConst = "fixed" ) -func (*BareMetalServerProfileNetworkInterfaceCount) isaBareMetalServerProfileNetworkInterfaceCount() bool { +func (*BareMetalServerProfileCpuCoreCount) isaBareMetalServerProfileCpuCoreCount() bool { return true } -type BareMetalServerProfileNetworkInterfaceCountIntf interface { - isaBareMetalServerProfileNetworkInterfaceCount() bool +type BareMetalServerProfileCpuCoreCountIntf interface { + isaBareMetalServerProfileCpuCoreCount() bool } -// UnmarshalBareMetalServerProfileNetworkInterfaceCount unmarshals an instance of BareMetalServerProfileNetworkInterfaceCount from the specified map of raw messages. -func UnmarshalBareMetalServerProfileNetworkInterfaceCount(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileNetworkInterfaceCount) +// UnmarshalBareMetalServerProfileCpuCoreCount unmarshals an instance of BareMetalServerProfileCpuCoreCount from the specified map of raw messages. +func UnmarshalBareMetalServerProfileCpuCoreCount(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileCpuCoreCount) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "max", &obj.Max) if err != nil { return @@ -28508,7 +30240,11 @@ func UnmarshalBareMetalServerProfileNetworkInterfaceCount(m map[string]json.RawM if err != nil { return } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) if err != nil { return } @@ -28516,32 +30252,73 @@ func UnmarshalBareMetalServerProfileNetworkInterfaceCount(m map[string]json.RawM return } -// BareMetalServerProfileOsArchitecture : BareMetalServerProfileOsArchitecture struct -type BareMetalServerProfileOsArchitecture struct { - // The default OS architecture for a bare metal server with this profile. - Default *string `json:"default" validate:"required"` - +// BareMetalServerProfileCpuSocketCount : BareMetalServerProfileCpuSocketCount struct +// Models which "extend" this model: +// - BareMetalServerProfileCpuSocketCountFixed +// - BareMetalServerProfileCpuSocketCountRange +// - BareMetalServerProfileCpuSocketCountEnum +// - BareMetalServerProfileCpuSocketCountDependent +type BareMetalServerProfileCpuSocketCount struct { // The type for this profile field. - Type *string `json:"type" validate:"required"` + Type *string `json:"type,omitempty"` - // The supported OS architecture(s) for a bare metal server with this profile. - Values []string `json:"values" validate:"required"` + // The value for this profile field. + Value *int64 `json:"value,omitempty"` + + // The default value for this profile field. + Default *int64 `json:"default,omitempty"` + + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The increment step value for this profile field. + Step *int64 `json:"step,omitempty"` + + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` } -// Constants associated with the BareMetalServerProfileOsArchitecture.Type property. +// Constants associated with the BareMetalServerProfileCpuSocketCount.Type property. // The type for this profile field. const ( - BareMetalServerProfileOsArchitectureTypeEnumConst = "enum" + BareMetalServerProfileCpuSocketCountTypeFixedConst = "fixed" ) -// UnmarshalBareMetalServerProfileOsArchitecture unmarshals an instance of BareMetalServerProfileOsArchitecture from the specified map of raw messages. -func UnmarshalBareMetalServerProfileOsArchitecture(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileOsArchitecture) +func (*BareMetalServerProfileCpuSocketCount) isaBareMetalServerProfileCpuSocketCount() bool { + return true +} + +type BareMetalServerProfileCpuSocketCountIntf interface { + isaBareMetalServerProfileCpuSocketCount() bool +} + +// UnmarshalBareMetalServerProfileCpuSocketCount unmarshals an instance of BareMetalServerProfileCpuSocketCount from the specified map of raw messages. +func UnmarshalBareMetalServerProfileCpuSocketCount(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileCpuSocketCount) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "default", &obj.Default) if err != nil { return } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) if err != nil { return } @@ -28553,36 +30330,45 @@ func UnmarshalBareMetalServerProfileOsArchitecture(m map[string]json.RawMessage, return } -// BareMetalServerProfileReference : BareMetalServerProfileReference struct -type BareMetalServerProfileReference struct { - // The URL for this bare metal server profile. - Href *string `json:"href" validate:"required"` +// BareMetalServerProfileCollection : BareMetalServerProfileCollection struct +type BareMetalServerProfileCollection struct { + // A link to the first page of resources. + First *BareMetalServerProfileCollectionFirst `json:"first" validate:"required"` - // The name for this bare metal server profile. - Name *string `json:"name" validate:"required"` + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *BareMetalServerProfileCollectionNext `json:"next,omitempty"` -// Constants associated with the BareMetalServerProfileReference.ResourceType property. -// The resource type. -const ( - BareMetalServerProfileReferenceResourceTypeBareMetalServerProfileConst = "bare_metal_server_profile" -) + // Collection of bare metal server profiles. + Profiles []BareMetalServerProfile `json:"profiles" validate:"required"` -// UnmarshalBareMetalServerProfileReference unmarshals an instance of BareMetalServerProfileReference from the specified map of raw messages. -func UnmarshalBareMetalServerProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileReference) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalBareMetalServerProfileCollection unmarshals an instance of BareMetalServerProfileCollection from the specified map of raw messages. +func UnmarshalBareMetalServerProfileCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBareMetalServerProfileCollectionFirst) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerProfileCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalBareMetalServerProfile) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) if err != nil { return } @@ -28590,37 +30376,77 @@ func UnmarshalBareMetalServerProfileReference(m map[string]json.RawMessage, resu return } -// BareMetalServerProfileSupportedTrustedPlatformModuleModes : The supported trusted platform module modes for this bare metal server profile. -type BareMetalServerProfileSupportedTrustedPlatformModuleModes struct { +// Retrieve the value to be passed to a request to access the next page of results +func (resp *BareMetalServerProfileCollection) 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 +} + +// BareMetalServerProfileCollectionFirst : A link to the first page of resources. +type BareMetalServerProfileCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalBareMetalServerProfileCollectionFirst unmarshals an instance of BareMetalServerProfileCollectionFirst from the specified map of raw messages. +func UnmarshalBareMetalServerProfileCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type BareMetalServerProfileCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalBareMetalServerProfileCollectionNext unmarshals an instance of BareMetalServerProfileCollectionNext from the specified map of raw messages. +func UnmarshalBareMetalServerProfileCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileConsoleTypes : The console type configuration for a bare metal server with this profile. +type BareMetalServerProfileConsoleTypes struct { // The type for this profile field. Type *string `json:"type" validate:"required"` - // The supported trusted platform module modes. + // The console types for a bare metal server with this profile. Values []string `json:"values" validate:"required"` } -// Constants associated with the BareMetalServerProfileSupportedTrustedPlatformModuleModes.Type property. +// Constants associated with the BareMetalServerProfileConsoleTypes.Type property. // The type for this profile field. const ( - BareMetalServerProfileSupportedTrustedPlatformModuleModesTypeEnumConst = "enum" + BareMetalServerProfileConsoleTypesTypeEnumConst = "enum" ) -// Constants associated with the BareMetalServerProfileSupportedTrustedPlatformModuleModes.Values property. -// The trusted platform module (TPM) mode: -// - `disabled`: No TPM functionality -// - `tpm_2`: TPM 2.0 -// -// 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. +// Constants associated with the BareMetalServerProfileConsoleTypes.Values property. +// A console type. const ( - BareMetalServerProfileSupportedTrustedPlatformModuleModesValuesDisabledConst = "disabled" - BareMetalServerProfileSupportedTrustedPlatformModuleModesValuesTpm2Const = "tpm_2" + BareMetalServerProfileConsoleTypesValuesSerialConst = "serial" + BareMetalServerProfileConsoleTypesValuesVncConst = "vnc" ) -// UnmarshalBareMetalServerProfileSupportedTrustedPlatformModuleModes unmarshals an instance of BareMetalServerProfileSupportedTrustedPlatformModuleModes from the specified map of raw messages. -func UnmarshalBareMetalServerProfileSupportedTrustedPlatformModuleModes(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileSupportedTrustedPlatformModuleModes) +// UnmarshalBareMetalServerProfileConsoleTypes unmarshals an instance of BareMetalServerProfileConsoleTypes from the specified map of raw messages. +func UnmarshalBareMetalServerProfileConsoleTypes(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileConsoleTypes) err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { return @@ -28633,50 +30459,27 @@ func UnmarshalBareMetalServerProfileSupportedTrustedPlatformModuleModes(m map[st return } -// BareMetalServerStatusReason : BareMetalServerStatusReason struct -type BareMetalServerStatusReason struct { - // The status reason code: - // - `cannot_start`: Failed to start due to an internal error - // - `cannot_start_capacity`: Insufficient capacity within the selected zone - // - `cannot_start_compute`: An error occurred while allocating compute resources - // - `cannot_start_ip_address`: An error occurred while allocating an IP address - // - `cannot_start_network`: An error occurred while allocating network resources. - Code *string `json:"code" validate:"required"` +// BareMetalServerProfileDisk : Disks provided by this profile. +type BareMetalServerProfileDisk struct { + Quantity BareMetalServerProfileDiskQuantityIntf `json:"quantity" validate:"required"` - // An explanation of the status reason. - Message *string `json:"message" validate:"required"` + Size BareMetalServerProfileDiskSizeIntf `json:"size" validate:"required"` - // Link to documentation about this status reason. - MoreInfo *string `json:"more_info,omitempty"` + SupportedInterfaceTypes *BareMetalServerProfileDiskSupportedInterfaces `json:"supported_interface_types" validate:"required"` } -// Constants associated with the BareMetalServerStatusReason.Code property. -// The status reason code: -// - `cannot_start`: Failed to start due to an internal error -// - `cannot_start_capacity`: Insufficient capacity within the selected zone -// - `cannot_start_compute`: An error occurred while allocating compute resources -// - `cannot_start_ip_address`: An error occurred while allocating an IP address -// - `cannot_start_network`: An error occurred while allocating network resources. -const ( - BareMetalServerStatusReasonCodeCannotStartConst = "cannot_start" - BareMetalServerStatusReasonCodeCannotStartCapacityConst = "cannot_start_capacity" - BareMetalServerStatusReasonCodeCannotStartComputeConst = "cannot_start_compute" - BareMetalServerStatusReasonCodeCannotStartIPAddressConst = "cannot_start_ip_address" - BareMetalServerStatusReasonCodeCannotStartNetworkConst = "cannot_start_network" -) - -// UnmarshalBareMetalServerStatusReason unmarshals an instance of BareMetalServerStatusReason from the specified map of raw messages. -func UnmarshalBareMetalServerStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerStatusReason) - err = core.UnmarshalPrimitive(m, "code", &obj.Code) +// UnmarshalBareMetalServerProfileDisk unmarshals an instance of BareMetalServerProfileDisk from the specified map of raw messages. +func UnmarshalBareMetalServerProfileDisk(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileDisk) + err = core.UnmarshalModel(m, "quantity", &obj.Quantity, UnmarshalBareMetalServerProfileDiskQuantity) if err != nil { return } - err = core.UnmarshalPrimitive(m, "message", &obj.Message) + err = core.UnmarshalModel(m, "size", &obj.Size, UnmarshalBareMetalServerProfileDiskSize) if err != nil { return } - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + err = core.UnmarshalModel(m, "supported_interface_types", &obj.SupportedInterfaceTypes, UnmarshalBareMetalServerProfileDiskSupportedInterfaces) if err != nil { return } @@ -28684,62 +30487,77 @@ func UnmarshalBareMetalServerStatusReason(m map[string]json.RawMessage, result i return } -// BareMetalServerTrustedPlatformModule : BareMetalServerTrustedPlatformModule struct -type BareMetalServerTrustedPlatformModule struct { - // Indicates whether the trusted platform module is enabled. - Enabled *bool `json:"enabled" validate:"required"` - - // The trusted platform module (TPM) mode: - // - `disabled`: No TPM functionality - // - `tpm_2`: TPM 2.0 - // - // 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. - Mode *string `json:"mode" validate:"required"` +// BareMetalServerProfileDiskQuantity : BareMetalServerProfileDiskQuantity struct +// Models which "extend" this model: +// - BareMetalServerProfileDiskQuantityFixed +// - BareMetalServerProfileDiskQuantityRange +// - BareMetalServerProfileDiskQuantityEnum +// - BareMetalServerProfileDiskQuantityDependent +type BareMetalServerProfileDiskQuantity struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` - // The supported trusted platform module modes. - SupportedModes []string `json:"supported_modes" validate:"required"` + // The value for this profile field. + Value *int64 `json:"value,omitempty"` + + // The default value for this profile field. + Default *int64 `json:"default,omitempty"` + + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The increment step value for this profile field. + Step *int64 `json:"step,omitempty"` + + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` } -// Constants associated with the BareMetalServerTrustedPlatformModule.Mode property. -// The trusted platform module (TPM) mode: -// - `disabled`: No TPM functionality -// - `tpm_2`: TPM 2.0 -// -// 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. +// Constants associated with the BareMetalServerProfileDiskQuantity.Type property. +// The type for this profile field. const ( - BareMetalServerTrustedPlatformModuleModeDisabledConst = "disabled" - BareMetalServerTrustedPlatformModuleModeTpm2Const = "tpm_2" + BareMetalServerProfileDiskQuantityTypeFixedConst = "fixed" ) -// Constants associated with the BareMetalServerTrustedPlatformModule.SupportedModes property. -// The trusted platform module (TPM) mode: -// - `disabled`: No TPM functionality -// - `tpm_2`: TPM 2.0 -// -// 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 ( - BareMetalServerTrustedPlatformModuleSupportedModesDisabledConst = "disabled" - BareMetalServerTrustedPlatformModuleSupportedModesTpm2Const = "tpm_2" -) +func (*BareMetalServerProfileDiskQuantity) isaBareMetalServerProfileDiskQuantity() bool { + return true +} -// UnmarshalBareMetalServerTrustedPlatformModule unmarshals an instance of BareMetalServerTrustedPlatformModule from the specified map of raw messages. -func UnmarshalBareMetalServerTrustedPlatformModule(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerTrustedPlatformModule) - err = core.UnmarshalPrimitive(m, "enabled", &obj.Enabled) +type BareMetalServerProfileDiskQuantityIntf interface { + isaBareMetalServerProfileDiskQuantity() bool +} + +// UnmarshalBareMetalServerProfileDiskQuantity unmarshals an instance of BareMetalServerProfileDiskQuantity from the specified map of raw messages. +func UnmarshalBareMetalServerProfileDiskQuantity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileDiskQuantity) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { return } - err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + err = core.UnmarshalPrimitive(m, "value", &obj.Value) if err != nil { return } - err = core.UnmarshalPrimitive(m, "supported_modes", &obj.SupportedModes) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) if err != nil { return } @@ -28747,29 +30565,77 @@ func UnmarshalBareMetalServerTrustedPlatformModule(m map[string]json.RawMessage, return } -// BareMetalServerTrustedPlatformModulePatch : BareMetalServerTrustedPlatformModulePatch struct -type BareMetalServerTrustedPlatformModulePatch struct { - // The trusted platform module mode to use. The specified value must be listed in the bare metal server's - // `supported_modes`. - // - // For the trusted platform module mode to be changed, the bare metal server `status` must be `stopped`. - Mode *string `json:"mode,omitempty"` +// BareMetalServerProfileDiskSize : BareMetalServerProfileDiskSize struct +// Models which "extend" this model: +// - BareMetalServerProfileDiskSizeFixed +// - BareMetalServerProfileDiskSizeRange +// - BareMetalServerProfileDiskSizeEnum +// - BareMetalServerProfileDiskSizeDependent +type BareMetalServerProfileDiskSize struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *int64 `json:"value,omitempty"` + + // The default value for this profile field. + Default *int64 `json:"default,omitempty"` + + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The increment step value for this profile field. + Step *int64 `json:"step,omitempty"` + + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` } -// Constants associated with the BareMetalServerTrustedPlatformModulePatch.Mode property. -// The trusted platform module mode to use. The specified value must be listed in the bare metal server's -// `supported_modes`. -// -// For the trusted platform module mode to be changed, the bare metal server `status` must be `stopped`. +// Constants associated with the BareMetalServerProfileDiskSize.Type property. +// The type for this profile field. const ( - BareMetalServerTrustedPlatformModulePatchModeDisabledConst = "disabled" - BareMetalServerTrustedPlatformModulePatchModeTpm2Const = "tpm_2" + BareMetalServerProfileDiskSizeTypeFixedConst = "fixed" ) -// UnmarshalBareMetalServerTrustedPlatformModulePatch unmarshals an instance of BareMetalServerTrustedPlatformModulePatch from the specified map of raw messages. -func UnmarshalBareMetalServerTrustedPlatformModulePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerTrustedPlatformModulePatch) - err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) +func (*BareMetalServerProfileDiskSize) isaBareMetalServerProfileDiskSize() bool { + return true +} + +type BareMetalServerProfileDiskSizeIntf interface { + isaBareMetalServerProfileDiskSize() bool +} + +// UnmarshalBareMetalServerProfileDiskSize unmarshals an instance of BareMetalServerProfileDiskSize from the specified map of raw messages. +func UnmarshalBareMetalServerProfileDiskSize(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileDiskSize) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) if err != nil { return } @@ -28777,25 +30643,76 @@ func UnmarshalBareMetalServerTrustedPlatformModulePatch(m map[string]json.RawMes return } -// BareMetalServerTrustedPlatformModulePrototype : BareMetalServerTrustedPlatformModulePrototype struct -type BareMetalServerTrustedPlatformModulePrototype struct { - // The trusted platform module mode to use. The specified value must be listed in the bare metal server profile's - // `supported_trusted_platform_module_modes`. - Mode *string `json:"mode,omitempty"` +// BareMetalServerProfileDiskSupportedInterfaces : BareMetalServerProfileDiskSupportedInterfaces struct +type BareMetalServerProfileDiskSupportedInterfaces struct { + // The disk interface used for attaching the disk. + // + // - `fcp`: Attached using Fiber Channel Protocol + // - `sata`: Attached using Serial Advanced Technology Attachment + // - `nvme`: Attached using Non-Volatile Memory Express + // + // 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. + Default *string `json:"default" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The supported disk interfaces used for attaching the disk. + Values []string `json:"values" validate:"required"` } -// Constants associated with the BareMetalServerTrustedPlatformModulePrototype.Mode property. -// The trusted platform module mode to use. The specified value must be listed in the bare metal server profile's -// `supported_trusted_platform_module_modes`. +// Constants associated with the BareMetalServerProfileDiskSupportedInterfaces.Default property. +// The disk interface used for attaching the disk. +// +// - `fcp`: Attached using Fiber Channel Protocol +// - `sata`: Attached using Serial Advanced Technology Attachment +// - `nvme`: Attached using Non-Volatile Memory Express +// +// 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 ( - BareMetalServerTrustedPlatformModulePrototypeModeDisabledConst = "disabled" - BareMetalServerTrustedPlatformModulePrototypeModeTpm2Const = "tpm_2" + BareMetalServerProfileDiskSupportedInterfacesDefaultFcpConst = "fcp" + BareMetalServerProfileDiskSupportedInterfacesDefaultNvmeConst = "nvme" + BareMetalServerProfileDiskSupportedInterfacesDefaultSataConst = "sata" ) -// UnmarshalBareMetalServerTrustedPlatformModulePrototype unmarshals an instance of BareMetalServerTrustedPlatformModulePrototype from the specified map of raw messages. -func UnmarshalBareMetalServerTrustedPlatformModulePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerTrustedPlatformModulePrototype) - err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) +// Constants associated with the BareMetalServerProfileDiskSupportedInterfaces.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileDiskSupportedInterfacesTypeEnumConst = "enum" +) + +// Constants associated with the BareMetalServerProfileDiskSupportedInterfaces.Values property. +// The disk interface used for attaching the disk. +// +// - `fcp`: Attached using Fiber Channel Protocol +// - `sata`: Attached using Serial Advanced Technology Attachment +// - `nvme`: Attached using Non-Volatile Memory Express +// +// 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 ( + BareMetalServerProfileDiskSupportedInterfacesValuesFcpConst = "fcp" + BareMetalServerProfileDiskSupportedInterfacesValuesNvmeConst = "nvme" + BareMetalServerProfileDiskSupportedInterfacesValuesSataConst = "sata" +) + +// UnmarshalBareMetalServerProfileDiskSupportedInterfaces unmarshals an instance of BareMetalServerProfileDiskSupportedInterfaces from the specified map of raw messages. +func UnmarshalBareMetalServerProfileDiskSupportedInterfaces(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileDiskSupportedInterfaces) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) if err != nil { return } @@ -28803,28 +30720,34 @@ func UnmarshalBareMetalServerTrustedPlatformModulePrototype(m map[string]json.Ra return } -// CatalogOfferingIdentity : Identifies a [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering by a unique -// property. +// BareMetalServerProfileIdentity : Identifies a bare metal server profile by a unique property. // Models which "extend" this model: -// - CatalogOfferingIdentityCatalogOfferingByCRN -type CatalogOfferingIdentity struct { - // The CRN for this - // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering. - CRN *string `json:"crn,omitempty"` +// - BareMetalServerProfileIdentityByName +// - BareMetalServerProfileIdentityByHref +type BareMetalServerProfileIdentity struct { + // The name for this bare metal server profile. + Name *string `json:"name,omitempty"` + + // The URL for this bare metal server profile. + Href *string `json:"href,omitempty"` } -func (*CatalogOfferingIdentity) isaCatalogOfferingIdentity() bool { +func (*BareMetalServerProfileIdentity) isaBareMetalServerProfileIdentity() bool { return true } -type CatalogOfferingIdentityIntf interface { - isaCatalogOfferingIdentity() bool +type BareMetalServerProfileIdentityIntf interface { + isaBareMetalServerProfileIdentity() bool } -// UnmarshalCatalogOfferingIdentity unmarshals an instance of CatalogOfferingIdentity from the specified map of raw messages. -func UnmarshalCatalogOfferingIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(CatalogOfferingIdentity) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) +// UnmarshalBareMetalServerProfileIdentity unmarshals an instance of BareMetalServerProfileIdentity from the specified map of raw messages. +func UnmarshalBareMetalServerProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } @@ -28832,28 +30755,77 @@ func UnmarshalCatalogOfferingIdentity(m map[string]json.RawMessage, result inter return } -// CatalogOfferingVersionIdentity : Identifies a version of a -// [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering by a unique property. +// BareMetalServerProfileMemory : BareMetalServerProfileMemory struct // Models which "extend" this model: -// - CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN -type CatalogOfferingVersionIdentity struct { - // The CRN for this version of a - // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering. - CRN *string `json:"crn,omitempty"` +// - BareMetalServerProfileMemoryFixed +// - BareMetalServerProfileMemoryRange +// - BareMetalServerProfileMemoryEnum +// - BareMetalServerProfileMemoryDependent +type BareMetalServerProfileMemory struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *int64 `json:"value,omitempty"` + + // The default value for this profile field. + Default *int64 `json:"default,omitempty"` + + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The increment step value for this profile field. + Step *int64 `json:"step,omitempty"` + + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` } -func (*CatalogOfferingVersionIdentity) isaCatalogOfferingVersionIdentity() bool { +// Constants associated with the BareMetalServerProfileMemory.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileMemoryTypeFixedConst = "fixed" +) + +func (*BareMetalServerProfileMemory) isaBareMetalServerProfileMemory() bool { return true } -type CatalogOfferingVersionIdentityIntf interface { - isaCatalogOfferingVersionIdentity() bool +type BareMetalServerProfileMemoryIntf interface { + isaBareMetalServerProfileMemory() bool } -// UnmarshalCatalogOfferingVersionIdentity unmarshals an instance of CatalogOfferingVersionIdentity from the specified map of raw messages. -func UnmarshalCatalogOfferingVersionIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(CatalogOfferingVersionIdentity) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) +// UnmarshalBareMetalServerProfileMemory unmarshals an instance of BareMetalServerProfileMemory from the specified map of raw messages. +func UnmarshalBareMetalServerProfileMemory(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileMemory) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) if err != nil { return } @@ -28861,17 +30833,47 @@ func UnmarshalCatalogOfferingVersionIdentity(m map[string]json.RawMessage, resul return } -// CatalogOfferingVersionReference : CatalogOfferingVersionReference struct -type CatalogOfferingVersionReference struct { - // The CRN for this version of a - // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering. - CRN *string `json:"crn" validate:"required"` +// BareMetalServerProfileNetworkAttachmentCount : BareMetalServerProfileNetworkAttachmentCount struct +// Models which "extend" this model: +// - BareMetalServerProfileNetworkAttachmentCountRange +// - BareMetalServerProfileNetworkAttachmentCountDependent +type BareMetalServerProfileNetworkAttachmentCount struct { + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The type for this profile field. + Type *string `json:"type,omitempty"` } -// UnmarshalCatalogOfferingVersionReference unmarshals an instance of CatalogOfferingVersionReference from the specified map of raw messages. -func UnmarshalCatalogOfferingVersionReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(CatalogOfferingVersionReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) +// Constants associated with the BareMetalServerProfileNetworkAttachmentCount.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileNetworkAttachmentCountTypeRangeConst = "range" +) + +func (*BareMetalServerProfileNetworkAttachmentCount) isaBareMetalServerProfileNetworkAttachmentCount() bool { + return true +} + +type BareMetalServerProfileNetworkAttachmentCountIntf interface { + isaBareMetalServerProfileNetworkAttachmentCount() bool +} + +// UnmarshalBareMetalServerProfileNetworkAttachmentCount unmarshals an instance of BareMetalServerProfileNetworkAttachmentCount from the specified map of raw messages. +func UnmarshalBareMetalServerProfileNetworkAttachmentCount(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileNetworkAttachmentCount) + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { return } @@ -28879,26 +30881,47 @@ func UnmarshalCatalogOfferingVersionReference(m map[string]json.RawMessage, resu return } -// CertificateInstanceIdentity : Identifies a certificate instance by a unique property. +// BareMetalServerProfileNetworkInterfaceCount : BareMetalServerProfileNetworkInterfaceCount struct // Models which "extend" this model: -// - CertificateInstanceIdentityByCRN -type CertificateInstanceIdentity struct { - // The CRN for this certificate instance. - CRN *string `json:"crn,omitempty"` +// - BareMetalServerProfileNetworkInterfaceCountRange +// - BareMetalServerProfileNetworkInterfaceCountDependent +type BareMetalServerProfileNetworkInterfaceCount struct { + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The type for this profile field. + Type *string `json:"type,omitempty"` } -func (*CertificateInstanceIdentity) isaCertificateInstanceIdentity() bool { +// Constants associated with the BareMetalServerProfileNetworkInterfaceCount.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileNetworkInterfaceCountTypeRangeConst = "range" +) + +func (*BareMetalServerProfileNetworkInterfaceCount) isaBareMetalServerProfileNetworkInterfaceCount() bool { return true } -type CertificateInstanceIdentityIntf interface { - isaCertificateInstanceIdentity() bool +type BareMetalServerProfileNetworkInterfaceCountIntf interface { + isaBareMetalServerProfileNetworkInterfaceCount() bool } -// UnmarshalCertificateInstanceIdentity unmarshals an instance of CertificateInstanceIdentity from the specified map of raw messages. -func UnmarshalCertificateInstanceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(CertificateInstanceIdentity) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) +// UnmarshalBareMetalServerProfileNetworkInterfaceCount unmarshals an instance of BareMetalServerProfileNetworkInterfaceCount from the specified map of raw messages. +func UnmarshalBareMetalServerProfileNetworkInterfaceCount(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileNetworkInterfaceCount) + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { return } @@ -28906,16 +30929,36 @@ func UnmarshalCertificateInstanceIdentity(m map[string]json.RawMessage, result i return } -// CertificateInstanceReference : CertificateInstanceReference struct -type CertificateInstanceReference struct { - // The CRN for this certificate instance. - CRN *string `json:"crn" validate:"required"` +// BareMetalServerProfileOsArchitecture : BareMetalServerProfileOsArchitecture struct +type BareMetalServerProfileOsArchitecture struct { + // The default OS architecture for a bare metal server with this profile. + Default *string `json:"default" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The supported OS architecture(s) for a bare metal server with this profile. + Values []string `json:"values" validate:"required"` } -// UnmarshalCertificateInstanceReference unmarshals an instance of CertificateInstanceReference from the specified map of raw messages. -func UnmarshalCertificateInstanceReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(CertificateInstanceReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) +// Constants associated with the BareMetalServerProfileOsArchitecture.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileOsArchitectureTypeEnumConst = "enum" +) + +// UnmarshalBareMetalServerProfileOsArchitecture unmarshals an instance of BareMetalServerProfileOsArchitecture from the specified map of raw messages. +func UnmarshalBareMetalServerProfileOsArchitecture(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileOsArchitecture) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) if err != nil { return } @@ -28923,33 +30966,545 @@ func UnmarshalCertificateInstanceReference(m map[string]json.RawMessage, result return } -// CheckVPNGatewayConnectionLocalCIDROptions : The CheckVPNGatewayConnectionLocalCIDR options. -type CheckVPNGatewayConnectionLocalCIDROptions 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="` +// BareMetalServerProfileReference : BareMetalServerProfileReference struct +type BareMetalServerProfileReference struct { + // The URL for this bare metal server profile. + Href *string `json:"href" validate:"required"` - // The prefix length part of the CIDR. - PrefixLength *string `json:"prefix_length" validate:"required,ne="` + // The name for this bare metal server profile. + Name *string `json:"name" validate:"required"` - // Allows users to set headers on API requests - Headers map[string]string + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` } -// NewCheckVPNGatewayConnectionLocalCIDROptions : Instantiate CheckVPNGatewayConnectionLocalCIDROptions -func (*VpcV1) NewCheckVPNGatewayConnectionLocalCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *CheckVPNGatewayConnectionLocalCIDROptions { - return &CheckVPNGatewayConnectionLocalCIDROptions{ - VPNGatewayID: core.StringPtr(vpnGatewayID), - ID: core.StringPtr(id), - CIDRPrefix: core.StringPtr(cidrPrefix), - PrefixLength: core.StringPtr(prefixLength), - } -} +// Constants associated with the BareMetalServerProfileReference.ResourceType property. +// The resource type. +const ( + BareMetalServerProfileReferenceResourceTypeBareMetalServerProfileConst = "bare_metal_server_profile" +) + +// UnmarshalBareMetalServerProfileReference unmarshals an instance of BareMetalServerProfileReference from the specified map of raw messages. +func UnmarshalBareMetalServerProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileReference) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + 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 +} + +// BareMetalServerProfileSupportedTrustedPlatformModuleModes : The supported trusted platform module modes for this bare metal server profile. +type BareMetalServerProfileSupportedTrustedPlatformModuleModes struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The supported trusted platform module modes. + Values []string `json:"values" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileSupportedTrustedPlatformModuleModes.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileSupportedTrustedPlatformModuleModesTypeEnumConst = "enum" +) + +// Constants associated with the BareMetalServerProfileSupportedTrustedPlatformModuleModes.Values property. +// The trusted platform module (TPM) mode: +// - `disabled`: No TPM functionality +// - `tpm_2`: TPM 2.0 +// +// 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 ( + BareMetalServerProfileSupportedTrustedPlatformModuleModesValuesDisabledConst = "disabled" + BareMetalServerProfileSupportedTrustedPlatformModuleModesValuesTpm2Const = "tpm_2" +) + +// UnmarshalBareMetalServerProfileSupportedTrustedPlatformModuleModes unmarshals an instance of BareMetalServerProfileSupportedTrustedPlatformModuleModes from the specified map of raw messages. +func UnmarshalBareMetalServerProfileSupportedTrustedPlatformModuleModes(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileSupportedTrustedPlatformModuleModes) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileVirtualNetworkInterfacesSupported : Indicates whether this profile supports virtual network interfaces. +type BareMetalServerProfileVirtualNetworkInterfacesSupported struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *bool `json:"value" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileVirtualNetworkInterfacesSupported.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileVirtualNetworkInterfacesSupportedTypeFixedConst = "fixed" +) + +// UnmarshalBareMetalServerProfileVirtualNetworkInterfacesSupported unmarshals an instance of BareMetalServerProfileVirtualNetworkInterfacesSupported from the specified map of raw messages. +func UnmarshalBareMetalServerProfileVirtualNetworkInterfacesSupported(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileVirtualNetworkInterfacesSupported) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerPrototype : BareMetalServerPrototype struct +// Models which "extend" this model: +// - BareMetalServerPrototypeBareMetalServerByNetworkAttachment +// - BareMetalServerPrototypeBareMetalServerByNetworkInterface +type BareMetalServerPrototype struct { + // 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,omitempty"` + + Initialization *BareMetalServerInitializationPrototype `json:"initialization" validate:"required"` + + // The name for this bare metal server. The name must not be used by another bare metal server in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + // + // The system hostname will be based on this name. + Name *string `json:"name,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) + // to use for this bare metal server. + Profile BareMetalServerProfileIdentityIntf `json:"profile" validate:"required"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + TrustedPlatformModule *BareMetalServerTrustedPlatformModulePrototype `json:"trusted_platform_module,omitempty"` + + // The VPC this bare metal server will reside in. + // + // If specified, it must match the VPC for the subnets that the network attachments or + // network interfaces of the bare metal server are attached to. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The zone this bare metal server will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the bare metal server. + NetworkAttachments []BareMetalServerNetworkAttachmentPrototypeIntf `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the bare metal server. + PrimaryNetworkAttachment BareMetalServerPrimaryNetworkAttachmentPrototypeIntf `json:"primary_network_attachment,omitempty"` + + // The additional bare metal server network interfaces to create. + NetworkInterfaces []BareMetalServerNetworkInterfacePrototypeIntf `json:"network_interfaces,omitempty"` + + // The primary bare metal server network interface to create. + PrimaryNetworkInterface *BareMetalServerPrimaryNetworkInterfacePrototype `json:"primary_network_interface,omitempty"` +} + +func (*BareMetalServerPrototype) isaBareMetalServerPrototype() bool { + return true +} + +type BareMetalServerPrototypeIntf interface { + isaBareMetalServerPrototype() bool +} + +// UnmarshalBareMetalServerPrototype unmarshals an instance of BareMetalServerPrototype from the specified map of raw messages. +func UnmarshalBareMetalServerPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerPrototype) + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + return + } + err = core.UnmarshalModel(m, "initialization", &obj.Initialization, UnmarshalBareMetalServerInitializationPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalBareMetalServerProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalBareMetalServerNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalBareMetalServerNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerStatusReason : BareMetalServerStatusReason struct +type BareMetalServerStatusReason struct { + // The status reason code: + // - `cannot_start`: Failed to start due to an internal error + // - `cannot_start_capacity`: Insufficient capacity within the selected zone + // - `cannot_start_compute`: An error occurred while allocating compute resources + // - `cannot_start_ip_address`: An error occurred while allocating an IP address + // - `cannot_start_network`: An error occurred while allocating network resources. + Code *string `json:"code" validate:"required"` + + // An explanation of the status reason. + Message *string `json:"message" validate:"required"` + + // Link to documentation about this status reason. + MoreInfo *string `json:"more_info,omitempty"` +} + +// Constants associated with the BareMetalServerStatusReason.Code property. +// The status reason code: +// - `cannot_start`: Failed to start due to an internal error +// - `cannot_start_capacity`: Insufficient capacity within the selected zone +// - `cannot_start_compute`: An error occurred while allocating compute resources +// - `cannot_start_ip_address`: An error occurred while allocating an IP address +// - `cannot_start_network`: An error occurred while allocating network resources. +const ( + BareMetalServerStatusReasonCodeCannotStartConst = "cannot_start" + BareMetalServerStatusReasonCodeCannotStartCapacityConst = "cannot_start_capacity" + BareMetalServerStatusReasonCodeCannotStartComputeConst = "cannot_start_compute" + BareMetalServerStatusReasonCodeCannotStartIPAddressConst = "cannot_start_ip_address" + BareMetalServerStatusReasonCodeCannotStartNetworkConst = "cannot_start_network" +) + +// UnmarshalBareMetalServerStatusReason unmarshals an instance of BareMetalServerStatusReason from the specified map of raw messages. +func UnmarshalBareMetalServerStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerStatusReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerTrustedPlatformModule : BareMetalServerTrustedPlatformModule struct +type BareMetalServerTrustedPlatformModule struct { + // Indicates whether the trusted platform module is enabled. + Enabled *bool `json:"enabled" validate:"required"` + + // The trusted platform module (TPM) mode: + // - `disabled`: No TPM functionality + // - `tpm_2`: TPM 2.0 + // + // 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. + Mode *string `json:"mode" validate:"required"` + + // The supported trusted platform module modes. + SupportedModes []string `json:"supported_modes" validate:"required"` +} + +// Constants associated with the BareMetalServerTrustedPlatformModule.Mode property. +// The trusted platform module (TPM) mode: +// - `disabled`: No TPM functionality +// - `tpm_2`: TPM 2.0 +// +// 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 ( + BareMetalServerTrustedPlatformModuleModeDisabledConst = "disabled" + BareMetalServerTrustedPlatformModuleModeTpm2Const = "tpm_2" +) + +// Constants associated with the BareMetalServerTrustedPlatformModule.SupportedModes property. +// The trusted platform module (TPM) mode: +// - `disabled`: No TPM functionality +// - `tpm_2`: TPM 2.0 +// +// 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 ( + BareMetalServerTrustedPlatformModuleSupportedModesDisabledConst = "disabled" + BareMetalServerTrustedPlatformModuleSupportedModesTpm2Const = "tpm_2" +) + +// UnmarshalBareMetalServerTrustedPlatformModule unmarshals an instance of BareMetalServerTrustedPlatformModule from the specified map of raw messages. +func UnmarshalBareMetalServerTrustedPlatformModule(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerTrustedPlatformModule) + err = core.UnmarshalPrimitive(m, "enabled", &obj.Enabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "supported_modes", &obj.SupportedModes) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerTrustedPlatformModulePatch : BareMetalServerTrustedPlatformModulePatch struct +type BareMetalServerTrustedPlatformModulePatch struct { + // The trusted platform module mode to use. The specified value must be listed in the bare metal server's + // `supported_modes`. + // + // For the trusted platform module mode to be changed, the bare metal server `status` must be `stopped`. + Mode *string `json:"mode,omitempty"` +} + +// Constants associated with the BareMetalServerTrustedPlatformModulePatch.Mode property. +// The trusted platform module mode to use. The specified value must be listed in the bare metal server's +// `supported_modes`. +// +// For the trusted platform module mode to be changed, the bare metal server `status` must be `stopped`. +const ( + BareMetalServerTrustedPlatformModulePatchModeDisabledConst = "disabled" + BareMetalServerTrustedPlatformModulePatchModeTpm2Const = "tpm_2" +) + +// UnmarshalBareMetalServerTrustedPlatformModulePatch unmarshals an instance of BareMetalServerTrustedPlatformModulePatch from the specified map of raw messages. +func UnmarshalBareMetalServerTrustedPlatformModulePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerTrustedPlatformModulePatch) + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerTrustedPlatformModulePrototype : BareMetalServerTrustedPlatformModulePrototype struct +type BareMetalServerTrustedPlatformModulePrototype struct { + // The trusted platform module mode to use. The specified value must be listed in the bare metal server profile's + // `supported_trusted_platform_module_modes`. + Mode *string `json:"mode,omitempty"` +} + +// Constants associated with the BareMetalServerTrustedPlatformModulePrototype.Mode property. +// The trusted platform module mode to use. The specified value must be listed in the bare metal server profile's +// `supported_trusted_platform_module_modes`. +const ( + BareMetalServerTrustedPlatformModulePrototypeModeDisabledConst = "disabled" + BareMetalServerTrustedPlatformModulePrototypeModeTpm2Const = "tpm_2" +) + +// UnmarshalBareMetalServerTrustedPlatformModulePrototype unmarshals an instance of BareMetalServerTrustedPlatformModulePrototype from the specified map of raw messages. +func UnmarshalBareMetalServerTrustedPlatformModulePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerTrustedPlatformModulePrototype) + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CatalogOfferingIdentity : Identifies a [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering by a unique +// property. +// Models which "extend" this model: +// - CatalogOfferingIdentityCatalogOfferingByCRN +type CatalogOfferingIdentity struct { + // The CRN for this + // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering. + CRN *string `json:"crn,omitempty"` +} + +func (*CatalogOfferingIdentity) isaCatalogOfferingIdentity() bool { + return true +} + +type CatalogOfferingIdentityIntf interface { + isaCatalogOfferingIdentity() bool +} + +// UnmarshalCatalogOfferingIdentity unmarshals an instance of CatalogOfferingIdentity from the specified map of raw messages. +func UnmarshalCatalogOfferingIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CatalogOfferingIdentity) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CatalogOfferingVersionIdentity : Identifies a version of a +// [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering by a unique property. +// Models which "extend" this model: +// - CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN +type CatalogOfferingVersionIdentity struct { + // The CRN for this version of a + // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering. + CRN *string `json:"crn,omitempty"` +} + +func (*CatalogOfferingVersionIdentity) isaCatalogOfferingVersionIdentity() bool { + return true +} + +type CatalogOfferingVersionIdentityIntf interface { + isaCatalogOfferingVersionIdentity() bool +} + +// UnmarshalCatalogOfferingVersionIdentity unmarshals an instance of CatalogOfferingVersionIdentity from the specified map of raw messages. +func UnmarshalCatalogOfferingVersionIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CatalogOfferingVersionIdentity) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CatalogOfferingVersionReference : CatalogOfferingVersionReference struct +type CatalogOfferingVersionReference struct { + // The CRN for this version of a + // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering. + CRN *string `json:"crn" validate:"required"` +} + +// UnmarshalCatalogOfferingVersionReference unmarshals an instance of CatalogOfferingVersionReference from the specified map of raw messages. +func UnmarshalCatalogOfferingVersionReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CatalogOfferingVersionReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CertificateInstanceIdentity : Identifies a certificate instance by a unique property. +// Models which "extend" this model: +// - CertificateInstanceIdentityByCRN +type CertificateInstanceIdentity struct { + // The CRN for this certificate instance. + CRN *string `json:"crn,omitempty"` +} + +func (*CertificateInstanceIdentity) isaCertificateInstanceIdentity() bool { + return true +} + +type CertificateInstanceIdentityIntf interface { + isaCertificateInstanceIdentity() bool +} + +// UnmarshalCertificateInstanceIdentity unmarshals an instance of CertificateInstanceIdentity from the specified map of raw messages. +func UnmarshalCertificateInstanceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CertificateInstanceIdentity) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CertificateInstanceReference : CertificateInstanceReference struct +type CertificateInstanceReference struct { + // The CRN for this certificate instance. + CRN *string `json:"crn" validate:"required"` +} + +// UnmarshalCertificateInstanceReference unmarshals an instance of CertificateInstanceReference from the specified map of raw messages. +func UnmarshalCertificateInstanceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CertificateInstanceReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CheckVPNGatewayConnectionLocalCIDROptions : The CheckVPNGatewayConnectionLocalCIDR options. +type CheckVPNGatewayConnectionLocalCIDROptions 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 +} + +// NewCheckVPNGatewayConnectionLocalCIDROptions : Instantiate CheckVPNGatewayConnectionLocalCIDROptions +func (*VpcV1) NewCheckVPNGatewayConnectionLocalCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *CheckVPNGatewayConnectionLocalCIDROptions { + return &CheckVPNGatewayConnectionLocalCIDROptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + CIDRPrefix: core.StringPtr(cidrPrefix), + PrefixLength: core.StringPtr(prefixLength), + } +} // SetVPNGatewayID : Allow user to set VPNGatewayID func (_options *CheckVPNGatewayConnectionLocalCIDROptions) SetVPNGatewayID(vpnGatewayID string) *CheckVPNGatewayConnectionLocalCIDROptions { @@ -29306,154 +31861,101 @@ func (options *CreateBareMetalServerConsoleAccessTokenOptions) SetHeaders(param return options } -// CreateBareMetalServerNetworkInterfaceOptions : The CreateBareMetalServerNetworkInterface options. -type CreateBareMetalServerNetworkInterfaceOptions struct { +// CreateBareMetalServerNetworkAttachmentOptions : The CreateBareMetalServerNetworkAttachment options. +type CreateBareMetalServerNetworkAttachmentOptions struct { // The bare metal server identifier. BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - // The bare metal server network interface prototype object. - BareMetalServerNetworkInterfacePrototype BareMetalServerNetworkInterfacePrototypeIntf `json:"BareMetalServerNetworkInterfacePrototype" validate:"required"` + // The bare metal server network attachment prototype object. + BareMetalServerNetworkAttachmentPrototype BareMetalServerNetworkAttachmentPrototypeIntf `json:"BareMetalServerNetworkAttachmentPrototype" validate:"required"` // Allows users to set headers on API requests Headers map[string]string } -// NewCreateBareMetalServerNetworkInterfaceOptions : Instantiate CreateBareMetalServerNetworkInterfaceOptions -func (*VpcV1) NewCreateBareMetalServerNetworkInterfaceOptions(bareMetalServerID string, bareMetalServerNetworkInterfacePrototype BareMetalServerNetworkInterfacePrototypeIntf) *CreateBareMetalServerNetworkInterfaceOptions { - return &CreateBareMetalServerNetworkInterfaceOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - BareMetalServerNetworkInterfacePrototype: bareMetalServerNetworkInterfacePrototype, +// NewCreateBareMetalServerNetworkAttachmentOptions : Instantiate CreateBareMetalServerNetworkAttachmentOptions +func (*VpcV1) NewCreateBareMetalServerNetworkAttachmentOptions(bareMetalServerID string, bareMetalServerNetworkAttachmentPrototype BareMetalServerNetworkAttachmentPrototypeIntf) *CreateBareMetalServerNetworkAttachmentOptions { + return &CreateBareMetalServerNetworkAttachmentOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + BareMetalServerNetworkAttachmentPrototype: bareMetalServerNetworkAttachmentPrototype, } } // SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *CreateBareMetalServerNetworkInterfaceOptions) SetBareMetalServerID(bareMetalServerID string) *CreateBareMetalServerNetworkInterfaceOptions { +func (_options *CreateBareMetalServerNetworkAttachmentOptions) SetBareMetalServerID(bareMetalServerID string) *CreateBareMetalServerNetworkAttachmentOptions { _options.BareMetalServerID = core.StringPtr(bareMetalServerID) return _options } -// SetBareMetalServerNetworkInterfacePrototype : Allow user to set BareMetalServerNetworkInterfacePrototype -func (_options *CreateBareMetalServerNetworkInterfaceOptions) SetBareMetalServerNetworkInterfacePrototype(bareMetalServerNetworkInterfacePrototype BareMetalServerNetworkInterfacePrototypeIntf) *CreateBareMetalServerNetworkInterfaceOptions { - _options.BareMetalServerNetworkInterfacePrototype = bareMetalServerNetworkInterfacePrototype +// SetBareMetalServerNetworkAttachmentPrototype : Allow user to set BareMetalServerNetworkAttachmentPrototype +func (_options *CreateBareMetalServerNetworkAttachmentOptions) SetBareMetalServerNetworkAttachmentPrototype(bareMetalServerNetworkAttachmentPrototype BareMetalServerNetworkAttachmentPrototypeIntf) *CreateBareMetalServerNetworkAttachmentOptions { + _options.BareMetalServerNetworkAttachmentPrototype = bareMetalServerNetworkAttachmentPrototype return _options } // SetHeaders : Allow user to set Headers -func (options *CreateBareMetalServerNetworkInterfaceOptions) SetHeaders(param map[string]string) *CreateBareMetalServerNetworkInterfaceOptions { +func (options *CreateBareMetalServerNetworkAttachmentOptions) SetHeaders(param map[string]string) *CreateBareMetalServerNetworkAttachmentOptions { options.Headers = param return options } -// CreateBareMetalServerOptions : The CreateBareMetalServer options. -type CreateBareMetalServerOptions struct { - Initialization *BareMetalServerInitializationPrototype `json:"initialization" validate:"required"` - - // The primary bare metal server network interface to create. - PrimaryNetworkInterface *BareMetalServerPrimaryNetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) - // to use for this bare metal server. - Profile BareMetalServerProfileIdentityIntf `json:"profile" validate:"required"` - - // The zone this bare metal server will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // 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,omitempty"` - - // The name for this bare metal server. The name must not be used by another bare metal server in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - // - // The system hostname will be based on this name. - Name *string `json:"name,omitempty"` - - // The additional bare metal server network interfaces to create. - NetworkInterfaces []BareMetalServerNetworkInterfacePrototypeIntf `json:"network_interfaces,omitempty"` - - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - TrustedPlatformModule *BareMetalServerTrustedPlatformModulePrototype `json:"trusted_platform_module,omitempty"` +// CreateBareMetalServerNetworkInterfaceOptions : The CreateBareMetalServerNetworkInterface options. +type CreateBareMetalServerNetworkInterfaceOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - // The VPC this bare metal server will reside in. - // - // If specified, it must match the VPC for the subnets that the network interfaces of - // the bare metal server are attached to. - VPC VPCIdentityIntf `json:"vpc,omitempty"` + // The bare metal server network interface prototype object. + BareMetalServerNetworkInterfacePrototype BareMetalServerNetworkInterfacePrototypeIntf `json:"BareMetalServerNetworkInterfacePrototype" validate:"required"` // Allows users to set headers on API requests Headers map[string]string } -// NewCreateBareMetalServerOptions : Instantiate CreateBareMetalServerOptions -func (*VpcV1) NewCreateBareMetalServerOptions(initialization *BareMetalServerInitializationPrototype, primaryNetworkInterface *BareMetalServerPrimaryNetworkInterfacePrototype, profile BareMetalServerProfileIdentityIntf, zone ZoneIdentityIntf) *CreateBareMetalServerOptions { - return &CreateBareMetalServerOptions{ - Initialization: initialization, - PrimaryNetworkInterface: primaryNetworkInterface, - Profile: profile, - Zone: zone, +// NewCreateBareMetalServerNetworkInterfaceOptions : Instantiate CreateBareMetalServerNetworkInterfaceOptions +func (*VpcV1) NewCreateBareMetalServerNetworkInterfaceOptions(bareMetalServerID string, bareMetalServerNetworkInterfacePrototype BareMetalServerNetworkInterfacePrototypeIntf) *CreateBareMetalServerNetworkInterfaceOptions { + return &CreateBareMetalServerNetworkInterfaceOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + BareMetalServerNetworkInterfacePrototype: bareMetalServerNetworkInterfacePrototype, } } -// SetInitialization : Allow user to set Initialization -func (_options *CreateBareMetalServerOptions) SetInitialization(initialization *BareMetalServerInitializationPrototype) *CreateBareMetalServerOptions { - _options.Initialization = initialization - return _options -} - -// SetPrimaryNetworkInterface : Allow user to set PrimaryNetworkInterface -func (_options *CreateBareMetalServerOptions) SetPrimaryNetworkInterface(primaryNetworkInterface *BareMetalServerPrimaryNetworkInterfacePrototype) *CreateBareMetalServerOptions { - _options.PrimaryNetworkInterface = primaryNetworkInterface - return _options -} - -// SetProfile : Allow user to set Profile -func (_options *CreateBareMetalServerOptions) SetProfile(profile BareMetalServerProfileIdentityIntf) *CreateBareMetalServerOptions { - _options.Profile = profile - return _options -} - -// SetZone : Allow user to set Zone -func (_options *CreateBareMetalServerOptions) SetZone(zone ZoneIdentityIntf) *CreateBareMetalServerOptions { - _options.Zone = zone +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *CreateBareMetalServerNetworkInterfaceOptions) SetBareMetalServerID(bareMetalServerID string) *CreateBareMetalServerNetworkInterfaceOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) return _options } -// SetEnableSecureBoot : Allow user to set EnableSecureBoot -func (_options *CreateBareMetalServerOptions) SetEnableSecureBoot(enableSecureBoot bool) *CreateBareMetalServerOptions { - _options.EnableSecureBoot = core.BoolPtr(enableSecureBoot) +// SetBareMetalServerNetworkInterfacePrototype : Allow user to set BareMetalServerNetworkInterfacePrototype +func (_options *CreateBareMetalServerNetworkInterfaceOptions) SetBareMetalServerNetworkInterfacePrototype(bareMetalServerNetworkInterfacePrototype BareMetalServerNetworkInterfacePrototypeIntf) *CreateBareMetalServerNetworkInterfaceOptions { + _options.BareMetalServerNetworkInterfacePrototype = bareMetalServerNetworkInterfacePrototype return _options } -// SetName : Allow user to set Name -func (_options *CreateBareMetalServerOptions) SetName(name string) *CreateBareMetalServerOptions { - _options.Name = core.StringPtr(name) - return _options +// SetHeaders : Allow user to set Headers +func (options *CreateBareMetalServerNetworkInterfaceOptions) SetHeaders(param map[string]string) *CreateBareMetalServerNetworkInterfaceOptions { + options.Headers = param + return options } -// SetNetworkInterfaces : Allow user to set NetworkInterfaces -func (_options *CreateBareMetalServerOptions) SetNetworkInterfaces(networkInterfaces []BareMetalServerNetworkInterfacePrototypeIntf) *CreateBareMetalServerOptions { - _options.NetworkInterfaces = networkInterfaces - return _options -} +// CreateBareMetalServerOptions : The CreateBareMetalServer options. +type CreateBareMetalServerOptions struct { + // The bare metal server prototype object. + BareMetalServerPrototype BareMetalServerPrototypeIntf `json:"BareMetalServerPrototype" validate:"required"` -// SetResourceGroup : Allow user to set ResourceGroup -func (_options *CreateBareMetalServerOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateBareMetalServerOptions { - _options.ResourceGroup = resourceGroup - return _options + // Allows users to set headers on API requests + Headers map[string]string } -// SetTrustedPlatformModule : Allow user to set TrustedPlatformModule -func (_options *CreateBareMetalServerOptions) SetTrustedPlatformModule(trustedPlatformModule *BareMetalServerTrustedPlatformModulePrototype) *CreateBareMetalServerOptions { - _options.TrustedPlatformModule = trustedPlatformModule - return _options +// NewCreateBareMetalServerOptions : Instantiate CreateBareMetalServerOptions +func (*VpcV1) NewCreateBareMetalServerOptions(bareMetalServerPrototype BareMetalServerPrototypeIntf) *CreateBareMetalServerOptions { + return &CreateBareMetalServerOptions{ + BareMetalServerPrototype: bareMetalServerPrototype, + } } -// SetVPC : Allow user to set VPC -func (_options *CreateBareMetalServerOptions) SetVPC(vpc VPCIdentityIntf) *CreateBareMetalServerOptions { - _options.VPC = vpc +// SetBareMetalServerPrototype : Allow user to set BareMetalServerPrototype +func (_options *CreateBareMetalServerOptions) SetBareMetalServerPrototype(bareMetalServerPrototype BareMetalServerPrototypeIntf) *CreateBareMetalServerOptions { + _options.BareMetalServerPrototype = bareMetalServerPrototype return _options } @@ -29694,9 +32196,14 @@ type CreateFlowLogCollectorOptions struct { // collector](https://cloud.ibm.com/docs/vpc?topic=vpc-ordering-flow-log-collector). StorageBucket LegacyCloudObjectStorageBucketIdentityIntf `json:"storage_bucket" validate:"required"` - // The target this collector will collect flow logs for. If the target is an instance, - // subnet, or VPC, flow logs will not be collected for any instance network interfaces within - // the target that are themselves the target of a more specific flow log collector. + // The target this collector will collect flow logs for. + // + // If the target is an instance, subnet, or VPC, flow logs will not be collected for any + // instance network attachments, virtual network interfaces or instance network interfaces + // within the target that are themselves the target of a more specific flow log collector. + // + // The target must not be a virtual network interface that is attached to a bare metal server + // network attachment or to a file share mount target. Target FlowLogCollectorTargetPrototypeIntf `json:"target" validate:"required"` // Indicates whether this collector will be active upon creation. @@ -30313,6 +32820,59 @@ func (options *CreateInstanceGroupOptions) SetHeaders(param map[string]string) * return options } +// CreateInstanceNetworkAttachmentOptions : The CreateInstanceNetworkAttachment options. +type CreateInstanceNetworkAttachmentOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // A virtual network interface for the instance network attachment. This can be specified + // using an existing virtual network interface, or a prototype object for a new virtual + // network interface. + // + // If an existing virtual network interface is specified, `enable_infrastructure_nat` must be + // `true`. + VirtualNetworkInterface InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf `json:"virtual_network_interface" validate:"required"` + + // The name for this network attachment. Names must be unique within the instance the network attachment 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 +} + +// NewCreateInstanceNetworkAttachmentOptions : Instantiate CreateInstanceNetworkAttachmentOptions +func (*VpcV1) NewCreateInstanceNetworkAttachmentOptions(instanceID string, virtualNetworkInterface InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf) *CreateInstanceNetworkAttachmentOptions { + return &CreateInstanceNetworkAttachmentOptions{ + InstanceID: core.StringPtr(instanceID), + VirtualNetworkInterface: virtualNetworkInterface, + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *CreateInstanceNetworkAttachmentOptions) SetInstanceID(instanceID string) *CreateInstanceNetworkAttachmentOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetVirtualNetworkInterface : Allow user to set VirtualNetworkInterface +func (_options *CreateInstanceNetworkAttachmentOptions) SetVirtualNetworkInterface(virtualNetworkInterface InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf) *CreateInstanceNetworkAttachmentOptions { + _options.VirtualNetworkInterface = virtualNetworkInterface + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateInstanceNetworkAttachmentOptions) SetName(name string) *CreateInstanceNetworkAttachmentOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateInstanceNetworkAttachmentOptions) SetHeaders(param map[string]string) *CreateInstanceNetworkAttachmentOptions { + options.Headers = param + return options +} + // CreateInstanceNetworkInterfaceOptions : The CreateInstanceNetworkInterface options. type CreateInstanceNetworkInterfaceOptions struct { // The virtual server instance identifier. @@ -30322,6 +32882,11 @@ type CreateInstanceNetworkInterfaceOptions struct { Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` // Indicates whether source IP spoofing is allowed on this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and source IP spoofing is managed on the attached virtual + // network interface. AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` // The name for the instance network interface. The name must not be used by another network interface on the virtual @@ -31131,9 +33696,6 @@ type CreateLoadBalancerOptions struct { // Load balancers in the `network` family allow only one subnet to be specified. Subnets []SubnetIdentityIntf `json:"subnets" validate:"required"` - // The datapath logging configuration for this load balancer. - Datapath *LoadBalancerLoggingDatapathPrototype `json:"datapath,omitempty"` - // The DNS configuration for this load balancer. // // If unspecified, DNS `A` records for this load balancer's `hostname` property will be added @@ -31146,7 +33708,7 @@ type CreateLoadBalancerOptions struct { // The logging configuration to use for this load balancer. See [VPC Datapath // Logging](https://cloud.ibm.com/docs/vpc?topic=vpc-datapath-logging) on the logging - // format, fields and permitted values. + // format, fields and permitted values. If unspecified, `datapath.active` will be `false`. // // To activate logging, the load balancer profile must support the specified logging type. Logging *LoadBalancerLoggingPrototype `json:"logging,omitempty"` @@ -31201,12 +33763,6 @@ func (_options *CreateLoadBalancerOptions) SetSubnets(subnets []SubnetIdentityIn return _options } -// SetDatapath : Allow user to set Datapath -func (_options *CreateLoadBalancerOptions) SetDatapath(datapath *LoadBalancerLoggingDatapathPrototype) *CreateLoadBalancerOptions { - _options.Datapath = datapath - return _options -} - // SetDns : Allow user to set Dns func (_options *CreateLoadBalancerOptions) SetDns(dns *LoadBalancerDnsPrototype) *CreateLoadBalancerOptions { _options.Dns = dns @@ -32022,8 +34578,9 @@ type CreateSubnetReservedIPOptions struct { // The target to bind this reserved IP to. The target must be in the same VPC. // - // At present, only endpoint gateway targets are supported. The endpoint gateway must - // not be already bound to a reserved IP in the subnet's zone. + // The following targets are supported: + // - An endpoint gateway not already bound to a reserved IP in the subnet's zone. + // - A virtual network interface. // // If unspecified, the reserved IP will be created unbound. Target ReservedIPTargetPrototypeIntf `json:"target,omitempty"` @@ -32075,6 +34632,136 @@ func (options *CreateSubnetReservedIPOptions) SetHeaders(param map[string]string return options } +// CreateVirtualNetworkInterfaceOptions : The CreateVirtualNetworkInterface options. +type CreateVirtualNetworkInterfaceOptions 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 whether this virtual network interface will be automatically deleted when + // `target` is deleted. Must be `false` if the virtual network interface is unbound. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - `floating_ips` must not have more than one floating IP. + // + // If `false`: + // - Packets are passed unchanged to/from the virtual network interface, + // allowing the workload to perform any needed NAT operations. + // - `allow_ip_spoofing` must be `false`. + // - Can only be attached to a `target` with a `resource_type` of + // `bare_metal_server_network_attachment`. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` + + // Additional IP addresses to bind to the virtual network interface. Each item may be either a reserved IP identity, or + // a reserved IP prototype object which will be used to create a new reserved IP. All IP addresses must be in the + // primary IP's subnet. + // + // If reserved IP identities are provided, the specified reserved IPs must be unbound. + // + // If reserved IP prototype objects with addresses are provided, the addresses must be available on the virtual network + // interface's subnet. For any prototype objects that do not specify an address, an available address on the subnet + // will be automatically selected and reserved. + Ips []VirtualNetworkInterfaceIPPrototypeIntf `json:"ips,omitempty"` + + // The name for this virtual network interface. The name must not be used by another virtual network interface in the + // VPC. If unspecified, the name will be a hyphenated list of randomly-selected words. Names beginning with `ibm-` are + // reserved for provider-owned resources, and are not allowed. + Name *string `json:"name,omitempty"` + + // The primary IP address to bind to the virtual network interface. May be either a + // reserved IP identity, or a reserved IP prototype object which will be used to create a + // new reserved IP. + // + // If a reserved IP identity is provided, the specified reserved IP must be unbound. + // + // If a reserved IP prototype object with an address is provided, the address must be + // available on the virtual network interface's subnet. If no address is specified, + // an available address on the subnet will be automatically selected and reserved. + PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The security groups to use for this virtual network interface. If unspecified, the default security group of the VPC + // for the subnet is used. + SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` + + // The associated subnet. Required if `primary_ip` does not specify a reserved IP + // identity. + Subnet SubnetIdentityIntf `json:"subnet,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateVirtualNetworkInterfaceOptions : Instantiate CreateVirtualNetworkInterfaceOptions +func (*VpcV1) NewCreateVirtualNetworkInterfaceOptions() *CreateVirtualNetworkInterfaceOptions { + return &CreateVirtualNetworkInterfaceOptions{} +} + +// SetAllowIPSpoofing : Allow user to set AllowIPSpoofing +func (_options *CreateVirtualNetworkInterfaceOptions) SetAllowIPSpoofing(allowIPSpoofing bool) *CreateVirtualNetworkInterfaceOptions { + _options.AllowIPSpoofing = core.BoolPtr(allowIPSpoofing) + return _options +} + +// SetAutoDelete : Allow user to set AutoDelete +func (_options *CreateVirtualNetworkInterfaceOptions) SetAutoDelete(autoDelete bool) *CreateVirtualNetworkInterfaceOptions { + _options.AutoDelete = core.BoolPtr(autoDelete) + return _options +} + +// SetEnableInfrastructureNat : Allow user to set EnableInfrastructureNat +func (_options *CreateVirtualNetworkInterfaceOptions) SetEnableInfrastructureNat(enableInfrastructureNat bool) *CreateVirtualNetworkInterfaceOptions { + _options.EnableInfrastructureNat = core.BoolPtr(enableInfrastructureNat) + return _options +} + +// SetIps : Allow user to set Ips +func (_options *CreateVirtualNetworkInterfaceOptions) SetIps(ips []VirtualNetworkInterfaceIPPrototypeIntf) *CreateVirtualNetworkInterfaceOptions { + _options.Ips = ips + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateVirtualNetworkInterfaceOptions) SetName(name string) *CreateVirtualNetworkInterfaceOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetPrimaryIP : Allow user to set PrimaryIP +func (_options *CreateVirtualNetworkInterfaceOptions) SetPrimaryIP(primaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf) *CreateVirtualNetworkInterfaceOptions { + _options.PrimaryIP = primaryIP + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateVirtualNetworkInterfaceOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateVirtualNetworkInterfaceOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetSecurityGroups : Allow user to set SecurityGroups +func (_options *CreateVirtualNetworkInterfaceOptions) SetSecurityGroups(securityGroups []SecurityGroupIdentityIntf) *CreateVirtualNetworkInterfaceOptions { + _options.SecurityGroups = securityGroups + return _options +} + +// SetSubnet : Allow user to set Subnet +func (_options *CreateVirtualNetworkInterfaceOptions) SetSubnet(subnet SubnetIdentityIntf) *CreateVirtualNetworkInterfaceOptions { + _options.Subnet = subnet + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateVirtualNetworkInterfaceOptions) SetHeaders(param map[string]string) *CreateVirtualNetworkInterfaceOptions { + options.Headers = param + return options +} + // CreateVolumeOptions : The CreateVolume options. type CreateVolumeOptions struct { // The volume prototype object. @@ -32341,6 +35028,13 @@ type CreateVPCRouteOptions struct { // - `drop`: drop the packet. Action *string `json:"action,omitempty"` + // Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` + // routing table property. + // + // All routes in a routing table with the same `destination` and `zone` must have the same + // `advertise` value. + Advertise *bool `json:"advertise,omitempty"` + // The name for this route. The name must not be used by another route in the routing table. Names starting with `ibm-` // are reserved for system-provided routes, and are not allowed. If unspecified, the name will be a hyphenated list of // randomly-selected words. @@ -32410,6 +35104,12 @@ func (_options *CreateVPCRouteOptions) SetAction(action string) *CreateVPCRouteO return _options } +// SetAdvertise : Allow user to set Advertise +func (_options *CreateVPCRouteOptions) SetAdvertise(advertise bool) *CreateVPCRouteOptions { + _options.Advertise = core.BoolPtr(advertise) + return _options +} + // SetName : Allow user to set Name func (_options *CreateVPCRouteOptions) SetName(name string) *CreateVPCRouteOptions { _options.Name = core.StringPtr(name) @@ -32445,6 +35145,10 @@ type CreateVPCRoutingTableOptions struct { // support is expected to expand in the future. AcceptRoutesFrom []ResourceFilter `json:"accept_routes_from,omitempty"` + // The ingress sources to advertise routes to. Routes in the table with `advertise` enabled will be advertised to these + // sources. + AdvertiseRoutesTo []string `json:"advertise_routes_to,omitempty"` + // The name for this routing table. The name must not be used by another routing table in the VPC. If unspecified, the // name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` @@ -32502,6 +35206,16 @@ type CreateVPCRoutingTableOptions struct { Headers map[string]string } +// Constants associated with the CreateVPCRoutingTableOptions.AdvertiseRoutesTo property. +// An ingress source that routes can be advertised to: +// +// - `direct_link` (requires `route_direct_link_ingress` be set to `true`) +// - `transit_gateway` (requires `route_transit_gateway_ingress` be set to `true`). +const ( + CreateVPCRoutingTableOptionsAdvertiseRoutesToDirectLinkConst = "direct_link" + CreateVPCRoutingTableOptionsAdvertiseRoutesToTransitGatewayConst = "transit_gateway" +) + // NewCreateVPCRoutingTableOptions : Instantiate CreateVPCRoutingTableOptions func (*VpcV1) NewCreateVPCRoutingTableOptions(vpcID string) *CreateVPCRoutingTableOptions { return &CreateVPCRoutingTableOptions{ @@ -32521,6 +35235,12 @@ func (_options *CreateVPCRoutingTableOptions) SetAcceptRoutesFrom(acceptRoutesFr return _options } +// SetAdvertiseRoutesTo : Allow user to set AdvertiseRoutesTo +func (_options *CreateVPCRoutingTableOptions) SetAdvertiseRoutesTo(advertiseRoutesTo []string) *CreateVPCRoutingTableOptions { + _options.AdvertiseRoutesTo = advertiseRoutesTo + return _options +} + // SetName : Allow user to set Name func (_options *CreateVPCRoutingTableOptions) SetName(name string) *CreateVPCRoutingTableOptions { _options.Name = core.StringPtr(name) @@ -32588,6 +35308,13 @@ type CreateVPCRoutingTableRouteOptions struct { // - `drop`: drop the packet. Action *string `json:"action,omitempty"` + // Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` + // routing table property. + // + // All routes in a routing table with the same `destination` and `zone` must have the same + // `advertise` value. + Advertise *bool `json:"advertise,omitempty"` + // The name for this route. The name must not be used by another route in the routing table. Names starting with `ibm-` // are reserved for system-provided routes, and are not allowed. If unspecified, the name will be a hyphenated list of // randomly-selected words. @@ -32664,6 +35391,12 @@ func (_options *CreateVPCRoutingTableRouteOptions) SetAction(action string) *Cre return _options } +// SetAdvertise : Allow user to set Advertise +func (_options *CreateVPCRoutingTableRouteOptions) SetAdvertise(advertise bool) *CreateVPCRoutingTableRouteOptions { + _options.Advertise = core.BoolPtr(advertise) + return _options +} + // SetName : Allow user to set Name func (_options *CreateVPCRoutingTableRouteOptions) SetName(name string) *CreateVPCRoutingTableRouteOptions { _options.Name = core.StringPtr(name) @@ -35061,6 +37794,14 @@ type DefaultRoutingTable struct { // support is expected to expand in the future. AcceptRoutesFrom []ResourceFilter `json:"accept_routes_from" validate:"required"` + // The ingress sources to advertise routes to. Routes in the table with `advertise` enabled will be advertised to these + // sources. + // + // 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. + AdvertiseRoutesTo []string `json:"advertise_routes_to" validate:"required"` + // The date and time that this routing table was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -35129,6 +37870,16 @@ type DefaultRoutingTable struct { Subnets []SubnetReference `json:"subnets" validate:"required"` } +// Constants associated with the DefaultRoutingTable.AdvertiseRoutesTo property. +// An ingress source that routes can be advertised to: +// +// - `direct_link` (requires `route_direct_link_ingress` be set to `true`) +// - `transit_gateway` (requires `route_transit_gateway_ingress` be set to `true`). +const ( + DefaultRoutingTableAdvertiseRoutesToDirectLinkConst = "direct_link" + DefaultRoutingTableAdvertiseRoutesToTransitGatewayConst = "transit_gateway" +) + // Constants associated with the DefaultRoutingTable.LifecycleState property. // The lifecycle state of the routing table. const ( @@ -35154,6 +37905,10 @@ func UnmarshalDefaultRoutingTable(m map[string]json.RawMessage, result interface if err != nil { return } + err = core.UnmarshalPrimitive(m, "advertise_routes_to", &obj.AdvertiseRoutesTo) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return @@ -35370,6 +38125,44 @@ func (options *DeleteBackupPolicyPlanOptions) SetHeaders(param map[string]string return options } +// DeleteBareMetalServerNetworkAttachmentOptions : The DeleteBareMetalServerNetworkAttachment options. +type DeleteBareMetalServerNetworkAttachmentOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + + // The bare metal server network attachment identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteBareMetalServerNetworkAttachmentOptions : Instantiate DeleteBareMetalServerNetworkAttachmentOptions +func (*VpcV1) NewDeleteBareMetalServerNetworkAttachmentOptions(bareMetalServerID string, id string) *DeleteBareMetalServerNetworkAttachmentOptions { + return &DeleteBareMetalServerNetworkAttachmentOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + ID: core.StringPtr(id), + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *DeleteBareMetalServerNetworkAttachmentOptions) SetBareMetalServerID(bareMetalServerID string) *DeleteBareMetalServerNetworkAttachmentOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteBareMetalServerNetworkAttachmentOptions) SetID(id string) *DeleteBareMetalServerNetworkAttachmentOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteBareMetalServerNetworkAttachmentOptions) SetHeaders(param map[string]string) *DeleteBareMetalServerNetworkAttachmentOptions { + options.Headers = param + return options +} + // DeleteBareMetalServerNetworkInterfaceOptions : The DeleteBareMetalServerNetworkInterface options. type DeleteBareMetalServerNetworkInterfaceOptions struct { // The bare metal server identifier. @@ -35926,6 +38719,44 @@ func (options *DeleteInstanceGroupOptions) SetHeaders(param map[string]string) * return options } +// DeleteInstanceNetworkAttachmentOptions : The DeleteInstanceNetworkAttachment options. +type DeleteInstanceNetworkAttachmentOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The instance network attachment identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteInstanceNetworkAttachmentOptions : Instantiate DeleteInstanceNetworkAttachmentOptions +func (*VpcV1) NewDeleteInstanceNetworkAttachmentOptions(instanceID string, id string) *DeleteInstanceNetworkAttachmentOptions { + return &DeleteInstanceNetworkAttachmentOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *DeleteInstanceNetworkAttachmentOptions) SetInstanceID(instanceID string) *DeleteInstanceNetworkAttachmentOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteInstanceNetworkAttachmentOptions) SetID(id string) *DeleteInstanceNetworkAttachmentOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceNetworkAttachmentOptions) SetHeaders(param map[string]string) *DeleteInstanceNetworkAttachmentOptions { + options.Headers = param + return options +} + // DeleteInstanceNetworkInterfaceOptions : The DeleteInstanceNetworkInterface options. type DeleteInstanceNetworkInterfaceOptions struct { // The virtual server instance identifier. @@ -36907,6 +39738,34 @@ func (options *DeleteSubnetReservedIPOptions) SetHeaders(param map[string]string return options } +// DeleteVirtualNetworkInterfacesOptions : The DeleteVirtualNetworkInterfaces options. +type DeleteVirtualNetworkInterfacesOptions struct { + // The virtual network interface identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteVirtualNetworkInterfacesOptions : Instantiate DeleteVirtualNetworkInterfacesOptions +func (*VpcV1) NewDeleteVirtualNetworkInterfacesOptions(id string) *DeleteVirtualNetworkInterfacesOptions { + return &DeleteVirtualNetworkInterfacesOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteVirtualNetworkInterfacesOptions) SetID(id string) *DeleteVirtualNetworkInterfacesOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVirtualNetworkInterfacesOptions) SetHeaders(param map[string]string) *DeleteVirtualNetworkInterfacesOptions { + options.Headers = param + return options +} + // DeleteVolumeOptions : The DeleteVolume options. type DeleteVolumeOptions struct { // The volume identifier. @@ -38345,6 +41204,98 @@ func UnmarshalFloatingIPCollectionNext(m map[string]json.RawMessage, result inte return } +// FloatingIPCollectionVirtualNetworkInterfaceContext : FloatingIPCollectionVirtualNetworkInterfaceContext struct +type FloatingIPCollectionVirtualNetworkInterfaceContext struct { + // A link to the first page of resources. + First *FloatingIPCollectionVirtualNetworkInterfaceContextFirst `json:"first" validate:"required"` + + // Collection of floating IPs bound to the virtual network interface specified by the identifier in the URL. + FloatingIps []FloatingIPReference `json:"floating_ips" 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 *FloatingIPCollectionVirtualNetworkInterfaceContextNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContext unmarshals an instance of FloatingIPCollectionVirtualNetworkInterfaceContext from the specified map of raw messages. +func UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPCollectionVirtualNetworkInterfaceContext) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContextFirst) + if err != nil { + return + } + err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContextNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + 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 *FloatingIPCollectionVirtualNetworkInterfaceContext) 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 +} + +// FloatingIPCollectionVirtualNetworkInterfaceContextFirst : A link to the first page of resources. +type FloatingIPCollectionVirtualNetworkInterfaceContextFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContextFirst unmarshals an instance of FloatingIPCollectionVirtualNetworkInterfaceContextFirst from the specified map of raw messages. +func UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContextFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPCollectionVirtualNetworkInterfaceContextFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPCollectionVirtualNetworkInterfaceContextNext : A link to the next page of resources. This property is present for all pages except the last page. +type FloatingIPCollectionVirtualNetworkInterfaceContextNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContextNext unmarshals an instance of FloatingIPCollectionVirtualNetworkInterfaceContextNext from the specified map of raw messages. +func UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContextNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPCollectionVirtualNetworkInterfaceContextNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // FloatingIPPatch : FloatingIPPatch struct type FloatingIPPatch struct { // The name for this floating IP. The name must not be used by another floating IP in the region. @@ -38358,6 +41309,7 @@ type FloatingIPPatch struct { // // - an instance network interface // - a bare metal server network interface with `enable_infrastructure_nat` set to `true` + // - a virtual network interface with `enable_infrastructure_nat` set to `true` // // Specify `null` to remove an existing binding. Target FloatingIPTargetPatchIntf `json:"target,omitempty"` @@ -38410,7 +41362,8 @@ type FloatingIPPrototype struct { // resource is: // // - an instance network interface - // - a bare metal server network interface with `enable_infrastructure_nat` set to `true`. + // - a bare metal server network interface with `enable_infrastructure_nat` set to `true` + // - a virtual network interface with `enable_infrastructure_nat` set to `true`. Target FloatingIPTargetPrototypeIntf `json:"target,omitempty"` } @@ -38521,15 +41474,25 @@ func UnmarshalFloatingIPReferenceDeleted(m map[string]json.RawMessage, result in // - FloatingIPTargetNetworkInterfaceReference // - FloatingIPTargetBareMetalServerNetworkInterfaceReference // - FloatingIPTargetPublicGatewayReference +// - FloatingIPTargetVirtualNetworkInterfaceReference type FloatingIPTarget struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. Deleted *NetworkInterfaceReferenceDeleted `json:"deleted,omitempty"` // The URL for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href,omitempty"` // The unique identifier for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the identifier is that of the corresponding network + // attachment. ID *string `json:"id,omitempty"` // The name for this instance network interface. @@ -38542,6 +41505,9 @@ type FloatingIPTarget struct { // The CRN for this public gateway. CRN *string `json:"crn,omitempty"` + + // The associated subnet. + Subnet *SubnetReference `json:"subnet,omitempty"` } // Constants associated with the FloatingIPTarget.ResourceType property. @@ -38589,6 +41555,10 @@ func UnmarshalFloatingIPTarget(m map[string]json.RawMessage, result interface{}) if err != nil { return } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -38600,17 +41570,31 @@ func UnmarshalFloatingIPTarget(m map[string]json.RawMessage, result interface{}) // // - an instance network interface // - a bare metal server network interface with `enable_infrastructure_nat` set to `true` +// - a virtual network interface with `enable_infrastructure_nat` set to `true` // // Specify `null` to remove an existing binding. // Models which "extend" this model: // - FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity // - FloatingIPTargetPatchNetworkInterfaceIdentity +// - FloatingIPTargetPatchVirtualNetworkInterfaceIdentity type FloatingIPTargetPatch struct { // The unique identifier for this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the identifier is that of the corresponding network + // attachment. ID *string `json:"id,omitempty"` // The URL for this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href,omitempty"` + + // The CRN for this virtual network interface. + CRN *string `json:"crn,omitempty"` } func (*FloatingIPTargetPatch) isaFloatingIPTargetPatch() bool { @@ -38632,6 +41616,10 @@ func UnmarshalFloatingIPTargetPatch(m map[string]json.RawMessage, result interfa if err != nil { return } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -38641,16 +41629,30 @@ func UnmarshalFloatingIPTargetPatch(m map[string]json.RawMessage, result interfa // The target resource must not already have a floating IP bound to it if the target resource is: // // - an instance network interface -// - a bare metal server network interface with `enable_infrastructure_nat` set to `true`. +// - a bare metal server network interface with `enable_infrastructure_nat` set to `true` +// - a virtual network interface with `enable_infrastructure_nat` set to `true`. // Models which "extend" this model: // - FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity // - FloatingIPTargetPrototypeNetworkInterfaceIdentity +// - FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity type FloatingIPTargetPrototype struct { // The unique identifier for this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the identifier is that of the corresponding network + // attachment. ID *string `json:"id,omitempty"` // The URL for this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href,omitempty"` + + // The CRN for this virtual network interface. + CRN *string `json:"crn,omitempty"` } func (*FloatingIPTargetPrototype) isaFloatingIPTargetPrototype() bool { @@ -38672,6 +41674,10 @@ func UnmarshalFloatingIPTargetPrototype(m map[string]json.RawMessage, result int if err != nil { return } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -38729,17 +41735,23 @@ type FlowLogCollector struct { StorageBucket *LegacyCloudObjectStorageBucketReference `json:"storage_bucket" validate:"required"` // The target this collector is collecting flow logs for. + // - If the target is an instance network attachment, flow logs will be collected + // for that instance network attachment. // - If the target is an instance network interface, flow logs will be collected // for that instance network interface. + // - If the target is a virtual network interface, flow logs will be collected for the + // the virtual network interface's `target` resource if the resource is: + // - an instance network attachment // - If the target is a virtual server instance, flow logs will be collected - // for all network interfaces on that instance. + // for all network attachments or network interfaces on that instance. // - If the target is a subnet, flow logs will be collected - // for all instance network interfaces attached to that subnet. - // - If the target is a VPC, flow logs will be collected for instance network interfaces - // attached to all subnets within that VPC. + // for all instance network interfaces and virtual network interfaces + // attached to that subnet. + // - If the target is a VPC, flow logs will be collected for all instance network + // interfaces and virtual network interfaces attached to all subnets within that VPC. // If the target is an instance, subnet, or VPC, flow logs will not be collected - // for any instance network interfaces within the target that are themselves the target of - // a more specific flow log collector. + // for any instance network attachments or instance network interfaces within the target + // that are themselves the target of a more specific flow log collector. Target FlowLogCollectorTargetIntf `json:"target" validate:"required"` // The VPC this flow log collector resides in. @@ -38941,31 +41953,48 @@ func (flowLogCollectorPatch *FlowLogCollectorPatch) AsPatch() (_patch map[string } // FlowLogCollectorTarget : The target this collector is collecting flow logs for. +// - If the target is an instance network attachment, flow logs will be collected +// for that instance network attachment. // - If the target is an instance network interface, flow logs will be collected // for that instance network interface. +// - If the target is a virtual network interface, flow logs will be collected for the +// the virtual network interface's `target` resource if the resource is: +// - an instance network attachment // - If the target is a virtual server instance, flow logs will be collected -// for all network interfaces on that instance. +// for all network attachments or network interfaces on that instance. // - If the target is a subnet, flow logs will be collected -// for all instance network interfaces attached to that subnet. -// - If the target is a VPC, flow logs will be collected for instance network interfaces -// attached to all subnets within that VPC. If the target is an instance, subnet, or VPC, flow logs will not be +// for all instance network interfaces and virtual network interfaces +// attached to that subnet. +// - If the target is a VPC, flow logs will be collected for all instance network +// interfaces and virtual network interfaces attached to all subnets within that VPC. If the target is an instance, // -// collected for any instance network interfaces within the target that are themselves the target of a more specific -// flow log collector. +// subnet, or VPC, flow logs will not be collected for any instance network attachments or instance network interfaces +// within the target that are themselves the target of a more specific flow log collector. // Models which "extend" this model: // - FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext // - FlowLogCollectorTargetInstanceReference // - FlowLogCollectorTargetSubnetReference // - FlowLogCollectorTargetVPCReference +// - FlowLogCollectorTargetInstanceNetworkAttachmentReference +// - FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext type FlowLogCollectorTarget 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 instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href,omitempty"` // The unique identifier for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the identifier is that of the corresponding network + // attachment. ID *string `json:"id,omitempty"` // The name for this instance network interface. @@ -38976,6 +42005,13 @@ type FlowLogCollectorTarget struct { // The CRN for this virtual server instance. CRN *string `json:"crn,omitempty"` + + // The primary IP address of the virtual network interface for the instance network + // attachment. + PrimaryIP *ReservedIPReference `json:"primary_ip,omitempty"` + + // The subnet of the virtual network interface for the instance network attachment. + Subnet *SubnetReference `json:"subnet,omitempty"` } // Constants associated with the FlowLogCollectorTarget.ResourceType property. @@ -39019,23 +42055,47 @@ func UnmarshalFlowLogCollectorTarget(m map[string]json.RawMessage, result interf if err != nil { return } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// FlowLogCollectorTargetPrototype : The target this collector will collect flow logs for. If the target is an instance, subnet, or VPC, flow logs will -// not be collected for any instance network interfaces within the target that are themselves the target of a more +// FlowLogCollectorTargetPrototype : The target this collector will collect flow logs for. +// +// If the target is an instance, subnet, or VPC, flow logs will not be collected for any instance network attachments, +// virtual network interfaces or instance network interfaces within the target that are themselves the target of a more // specific flow log collector. +// +// The target must not be a virtual network interface that is attached to a bare metal server network attachment or to a +// file share mount target. // Models which "extend" this model: // - FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity // - FlowLogCollectorTargetPrototypeInstanceIdentity // - FlowLogCollectorTargetPrototypeSubnetIdentity // - FlowLogCollectorTargetPrototypeVPCIdentity +// - FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity +// - FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity type FlowLogCollectorTargetPrototype struct { // The unique identifier for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the identifier is that of the corresponding network + // attachment. ID *string `json:"id,omitempty"` // The URL for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href,omitempty"` // The CRN for this virtual server instance. @@ -39257,6 +42317,44 @@ func (options *GetBareMetalServerInitializationOptions) SetHeaders(param map[str return options } +// GetBareMetalServerNetworkAttachmentOptions : The GetBareMetalServerNetworkAttachment options. +type GetBareMetalServerNetworkAttachmentOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + + // The bare metal server network attachment identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetBareMetalServerNetworkAttachmentOptions : Instantiate GetBareMetalServerNetworkAttachmentOptions +func (*VpcV1) NewGetBareMetalServerNetworkAttachmentOptions(bareMetalServerID string, id string) *GetBareMetalServerNetworkAttachmentOptions { + return &GetBareMetalServerNetworkAttachmentOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + ID: core.StringPtr(id), + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *GetBareMetalServerNetworkAttachmentOptions) SetBareMetalServerID(bareMetalServerID string) *GetBareMetalServerNetworkAttachmentOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetBareMetalServerNetworkAttachmentOptions) SetID(id string) *GetBareMetalServerNetworkAttachmentOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetBareMetalServerNetworkAttachmentOptions) SetHeaders(param map[string]string) *GetBareMetalServerNetworkAttachmentOptions { + options.Headers = param + return options +} + // GetBareMetalServerNetworkInterfaceFloatingIPOptions : The GetBareMetalServerNetworkInterfaceFloatingIP options. type GetBareMetalServerNetworkInterfaceFloatingIPOptions struct { // The bare metal server identifier. @@ -40051,6 +43149,44 @@ func (options *GetInstanceInitializationOptions) SetHeaders(param map[string]str return options } +// GetInstanceNetworkAttachmentOptions : The GetInstanceNetworkAttachment options. +type GetInstanceNetworkAttachmentOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The instance network attachment identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceNetworkAttachmentOptions : Instantiate GetInstanceNetworkAttachmentOptions +func (*VpcV1) NewGetInstanceNetworkAttachmentOptions(instanceID string, id string) *GetInstanceNetworkAttachmentOptions { + return &GetInstanceNetworkAttachmentOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *GetInstanceNetworkAttachmentOptions) SetInstanceID(instanceID string) *GetInstanceNetworkAttachmentOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetInstanceNetworkAttachmentOptions) SetID(id string) *GetInstanceNetworkAttachmentOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceNetworkAttachmentOptions) SetHeaders(param map[string]string) *GetInstanceNetworkAttachmentOptions { + options.Headers = param + return options +} + // GetInstanceNetworkInterfaceFloatingIPOptions : The GetInstanceNetworkInterfaceFloatingIP options. type GetInstanceNetworkInterfaceFloatingIPOptions struct { // The virtual server instance identifier. @@ -40743,6 +43879,44 @@ func (options *GetNetworkACLRuleOptions) SetHeaders(param map[string]string) *Ge return options } +// GetNetworkInterfaceFloatingIPOptions : The GetNetworkInterfaceFloatingIP options. +type GetNetworkInterfaceFloatingIPOptions struct { + // The virtual network interface identifier. + VirtualNetworkInterfaceID *string `json:"virtual_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 +} + +// NewGetNetworkInterfaceFloatingIPOptions : Instantiate GetNetworkInterfaceFloatingIPOptions +func (*VpcV1) NewGetNetworkInterfaceFloatingIPOptions(virtualNetworkInterfaceID string, id string) *GetNetworkInterfaceFloatingIPOptions { + return &GetNetworkInterfaceFloatingIPOptions{ + VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID), + ID: core.StringPtr(id), + } +} + +// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID +func (_options *GetNetworkInterfaceFloatingIPOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *GetNetworkInterfaceFloatingIPOptions { + _options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetNetworkInterfaceFloatingIPOptions) SetID(id string) *GetNetworkInterfaceFloatingIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *GetNetworkInterfaceFloatingIPOptions { + options.Headers = param + return options +} + // GetOperatingSystemOptions : The GetOperatingSystem options. type GetOperatingSystemOptions struct { // The operating system name. @@ -41363,6 +44537,44 @@ func (options *GetSubnetRoutingTableOptions) SetHeaders(param map[string]string) return options } +// GetVirtualNetworkInterfaceIPOptions : The GetVirtualNetworkInterfaceIP options. +type GetVirtualNetworkInterfaceIPOptions struct { + // The virtual network interface identifier. + VirtualNetworkInterfaceID *string `json:"virtual_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 +} + +// NewGetVirtualNetworkInterfaceIPOptions : Instantiate GetVirtualNetworkInterfaceIPOptions +func (*VpcV1) NewGetVirtualNetworkInterfaceIPOptions(virtualNetworkInterfaceID string, id string) *GetVirtualNetworkInterfaceIPOptions { + return &GetVirtualNetworkInterfaceIPOptions{ + VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID), + ID: core.StringPtr(id), + } +} + +// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID +func (_options *GetVirtualNetworkInterfaceIPOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *GetVirtualNetworkInterfaceIPOptions { + _options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetVirtualNetworkInterfaceIPOptions) SetID(id string) *GetVirtualNetworkInterfaceIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVirtualNetworkInterfaceIPOptions) SetHeaders(param map[string]string) *GetVirtualNetworkInterfaceIPOptions { + options.Headers = param + return options +} + // GetVirtualNetworkInterfaceOptions : The GetVirtualNetworkInterface options. type GetVirtualNetworkInterfaceOptions struct { // The virtual network interface identifier. @@ -43895,8 +47107,8 @@ type Instance struct { // The availability policy for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicy `json:"availability_policy" validate:"required"` - // The total bandwidth (in megabits per second) shared across the instance network interfaces and storage volumes of - // virtual server instance. + // The total bandwidth (in megabits per second) shared across the instance network attachments or instance network + // interfaces and storage volumes of the virtual server instance. Bandwidth *int64 `json:"bandwidth" validate:"required"` // Boot volume attachment. @@ -43949,7 +47161,14 @@ type Instance struct { // The name for this virtual server instance. The name is unique across all virtual server instances in the region. Name *string `json:"name" validate:"required"` + // The network attachments for this virtual server instance, including the primary network attachment. + NetworkAttachments []InstanceNetworkAttachmentReference `json:"network_attachments" validate:"required"` + // The network interfaces for this instance, including the primary network interface. + // + // If this instance has network attachments, each network interface is a [read-only + // representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network attachment + // and its attached virtual network interface. NetworkInterfaces []NetworkInterfaceInstanceContextReference `json:"network_interfaces" validate:"required"` // The number of NUMA nodes this virtual server instance is provisioned on. @@ -43960,7 +47179,15 @@ type Instance struct { // The placement restrictions for the virtual server instance. PlacementTarget InstancePlacementTargetIntf `json:"placement_target,omitempty"` + // The primary network attachment for this virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentReference `json:"primary_network_attachment,omitempty"` + // The primary network interface for this virtual server instance. + // + // If this instance has network attachments, this primary network interface is a + // [read-only + // representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) + // of the primary network attachment and its attached virtual network interface. PrimaryNetworkInterface *NetworkInterfaceInstanceContextReference `json:"primary_network_interface" validate:"required"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) for this virtual @@ -43990,7 +47217,8 @@ type Instance struct { // unexpected reason code was encountered. StatusReasons []InstanceStatusReason `json:"status_reasons" validate:"required"` - // The amount of bandwidth (in megabits per second) allocated exclusively to instance network interfaces. + // The amount of bandwidth (in megabits per second) allocated exclusively to instance network attachments or instance + // network interfaces. TotalNetworkBandwidth *int64 `json:"total_network_bandwidth" validate:"required"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in @@ -44117,6 +47345,10 @@ func UnmarshalInstance(m map[string]json.RawMessage, result interface{}) (err er if err != nil { return } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentReference) + if err != nil { + return + } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfaceInstanceContextReference) if err != nil { return @@ -44129,6 +47361,10 @@ func UnmarshalInstance(m map[string]json.RawMessage, result interface{}) (err er if err != nil { return } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentReference) + if err != nil { + return + } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfaceInstanceContextReference) if err != nil { return @@ -47086,6 +50322,428 @@ func UnmarshalInstanceMetadataServicePrototype(m map[string]json.RawMessage, res return } +// InstanceNetworkAttachment : InstanceNetworkAttachment struct +type InstanceNetworkAttachment struct { + // The date and time that the instance network attachment was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this instance network attachment. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance network attachment. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of the instance network attachment. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The name for this instance network attachment. The name is unique across all network attachments for the instance. + Name *string `json:"name" validate:"required"` + + // The port speed for this instance network attachment in Mbps. + PortSpeed *int64 `json:"port_speed" validate:"required"` + + // The primary IP address of the virtual network interface for the instance network + // attachment. + PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The subnet of the virtual network interface for the instance network attachment. + Subnet *SubnetReference `json:"subnet" validate:"required"` + + // The instance network attachment type. + Type *string `json:"type" validate:"required"` + + // The virtual network interface for this instance network attachment. + VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" validate:"required"` +} + +// Constants associated with the InstanceNetworkAttachment.LifecycleState property. +// The lifecycle state of the instance network attachment. +const ( + InstanceNetworkAttachmentLifecycleStateDeletingConst = "deleting" + InstanceNetworkAttachmentLifecycleStateFailedConst = "failed" + InstanceNetworkAttachmentLifecycleStatePendingConst = "pending" + InstanceNetworkAttachmentLifecycleStateStableConst = "stable" + InstanceNetworkAttachmentLifecycleStateSuspendedConst = "suspended" + InstanceNetworkAttachmentLifecycleStateUpdatingConst = "updating" + InstanceNetworkAttachmentLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the InstanceNetworkAttachment.ResourceType property. +// The resource type. +const ( + InstanceNetworkAttachmentResourceTypeInstanceNetworkAttachmentConst = "instance_network_attachment" +) + +// Constants associated with the InstanceNetworkAttachment.Type property. +// The instance network attachment type. +const ( + InstanceNetworkAttachmentTypePrimaryConst = "primary" + InstanceNetworkAttachmentTypeSecondaryConst = "secondary" +) + +// UnmarshalInstanceNetworkAttachment unmarshals an instance of InstanceNetworkAttachment from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachment) + 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, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceNetworkAttachmentCollection : InstanceNetworkAttachmentCollection struct +type InstanceNetworkAttachmentCollection struct { + // Collection of instance network attachments. + NetworkAttachments []InstanceNetworkAttachment `json:"network_attachments" validate:"required"` +} + +// UnmarshalInstanceNetworkAttachmentCollection unmarshals an instance of InstanceNetworkAttachmentCollection from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachmentCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachmentCollection) + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachment) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceNetworkAttachmentPatch : InstanceNetworkAttachmentPatch struct +type InstanceNetworkAttachmentPatch struct { + // The name for this network attachment. The name must not be used by another network attachment for the instance. + Name *string `json:"name,omitempty"` +} + +// UnmarshalInstanceNetworkAttachmentPatch unmarshals an instance of InstanceNetworkAttachmentPatch from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachmentPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachmentPatch) + 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 InstanceNetworkAttachmentPatch +func (instanceNetworkAttachmentPatch *InstanceNetworkAttachmentPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(instanceNetworkAttachmentPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// InstanceNetworkAttachmentPrototype : InstanceNetworkAttachmentPrototype struct +type InstanceNetworkAttachmentPrototype struct { + // The name for this network attachment. Names must be unique within the instance the network attachment resides in. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // A virtual network interface for the instance network attachment. This can be specified + // using an existing virtual network interface, or a prototype object for a new virtual + // network interface. + // + // If an existing virtual network interface is specified, `enable_infrastructure_nat` must be + // `true`. + VirtualNetworkInterface InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf `json:"virtual_network_interface" validate:"required"` +} + +// NewInstanceNetworkAttachmentPrototype : Instantiate InstanceNetworkAttachmentPrototype (Generic Model Constructor) +func (*VpcV1) NewInstanceNetworkAttachmentPrototype(virtualNetworkInterface InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf) (_model *InstanceNetworkAttachmentPrototype, err error) { + _model = &InstanceNetworkAttachmentPrototype{ + VirtualNetworkInterface: virtualNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalInstanceNetworkAttachmentPrototype unmarshals an instance of InstanceNetworkAttachmentPrototype from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachmentPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachmentPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterface) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceNetworkAttachmentPrototypeVirtualNetworkInterface : A virtual network interface for the instance network attachment. This can be specified using an existing virtual +// network interface, or a prototype object for a new virtual network interface. +// +// If an existing virtual network interface is specified, `enable_infrastructure_nat` must be +// `true`. +// Models which "extend" this model: +// - InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext +// - InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity +type InstanceNetworkAttachmentPrototypeVirtualNetworkInterface 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 whether this virtual network interface will be automatically deleted when + // `target` is deleted. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - `floating_ips` must not have more than one floating IP. + // + // If `false`: + // - Packets are passed unchanged to/from the virtual network interface, + // allowing the workload to perform any needed NAT operations. + // - `allow_ip_spoofing` must be `false`. + // - Can only be attached to a `target` with a `resource_type` of + // `bare_metal_server_network_attachment`. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` + + // Additional IP addresses to bind to the virtual network interface. Each item may be either a reserved IP identity, or + // a reserved IP prototype object which will be used to create a new reserved IP. All IP addresses must be in the + // primary IP's subnet. + // + // If reserved IP identities are provided, the specified reserved IPs must be unbound. + // + // If reserved IP prototype objects with addresses are provided, the addresses must be available on the virtual network + // interface's subnet. For any prototype objects that do not specify an address, an available address on the subnet + // will be automatically selected and reserved. + Ips []VirtualNetworkInterfaceIPPrototypeIntf `json:"ips,omitempty"` + + // The name for this virtual network interface. The name must not be used by another virtual network interface in the + // VPC. If unspecified, the name will be a hyphenated list of randomly-selected words. Names beginning with `ibm-` are + // reserved for provider-owned resources, and are not allowed. + Name *string `json:"name,omitempty"` + + // The primary IP address to bind to the virtual network interface. May be either a + // reserved IP identity, or a reserved IP prototype object which will be used to create a + // new reserved IP. + // + // If a reserved IP identity is provided, the specified reserved IP must be unbound. + // + // If a reserved IP prototype object with an address is provided, the address must be + // available on the virtual network interface's subnet. If no address is specified, + // an available address on the subnet will be automatically selected and reserved. + PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"` + + // The resource group to use for this virtual network interface. If unspecified, the + // virtual server instance's resource group will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The security groups to use for this virtual network interface. If unspecified, the default security group of the VPC + // for the subnet is used. + SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` + + // The associated subnet. Required if `primary_ip` does not specify a reserved IP + // identity. + Subnet SubnetIdentityIntf `json:"subnet,omitempty"` + + // The unique identifier for this virtual network interface. + ID *string `json:"id,omitempty"` + + // The URL for this virtual network interface. + Href *string `json:"href,omitempty"` + + // The CRN for this virtual network interface. + CRN *string `json:"crn,omitempty"` +} + +func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterface) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf interface { + isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool +} + +// UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterface unmarshals an instance of InstanceNetworkAttachmentPrototypeVirtualNetworkInterface from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterface) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + 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 + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceNetworkAttachmentReference : InstanceNetworkAttachmentReference struct +type InstanceNetworkAttachmentReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceNetworkAttachmentReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this instance network attachment. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance network attachment. + ID *string `json:"id" validate:"required"` + + // The name for this instance network attachment. The name is unique across all network attachments for the instance. + Name *string `json:"name" validate:"required"` + + // The primary IP address of the virtual network interface for the instance network + // attachment. + PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The subnet of the virtual network interface for the instance network attachment. + Subnet *SubnetReference `json:"subnet" validate:"required"` +} + +// Constants associated with the InstanceNetworkAttachmentReference.ResourceType property. +// The resource type. +const ( + InstanceNetworkAttachmentReferenceResourceTypeInstanceNetworkAttachmentConst = "instance_network_attachment" +) + +// UnmarshalInstanceNetworkAttachmentReference unmarshals an instance of InstanceNetworkAttachmentReference from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachmentReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachmentReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceNetworkAttachmentReferenceDeleted) + 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.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceNetworkAttachmentReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type InstanceNetworkAttachmentReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalInstanceNetworkAttachmentReferenceDeleted unmarshals an instance of InstanceNetworkAttachmentReferenceDeleted from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachmentReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachmentReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // InstancePatch : InstancePatch struct type InstancePatch struct { // The availability policy for this virtual server instance. @@ -47112,7 +50770,8 @@ type InstancePatch struct { // instance is placed on a dedicated host, the requested profile `family` must be // the same as the dedicated host `family`. // - Have the same `vcpu.architecture`. - // - Support the number of network interfaces the instance currently has. + // - Support the number of network attachments or network interfaces the instance + // currently has. Profile InstancePatchProfileIntf `json:"profile,omitempty"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in @@ -47171,7 +50830,8 @@ func (instancePatch *InstancePatch) AsPatch() (_patch map[string]interface{}, er // instance is placed on a dedicated host, the requested profile `family` must be // the same as the dedicated host `family`. // - Have the same `vcpu.architecture`. -// - Support the number of network interfaces the instance currently has. +// - Support the number of network attachments or network interfaces the instance +// currently has. // // Models which "extend" this model: // - InstancePatchProfileInstanceProfileIdentityByName @@ -47389,6 +51049,8 @@ type InstanceProfile struct { // The globally unique name for this virtual server instance profile. Name *string `json:"name" validate:"required"` + NetworkAttachmentCount InstanceProfileNetworkAttachmentCountIntf `json:"network_attachment_count" validate:"required"` + NetworkInterfaceCount InstanceProfileNetworkInterfaceCountIntf `json:"network_interface_count" validate:"required"` NumaCount InstanceProfileNumaCountIntf `json:"numa_count,omitempty"` @@ -47483,6 +51145,10 @@ func UnmarshalInstanceProfile(m map[string]json.RawMessage, result interface{}) if err != nil { return } + err = core.UnmarshalModel(m, "network_attachment_count", &obj.NetworkAttachmentCount, UnmarshalInstanceProfileNetworkAttachmentCount) + if err != nil { + return + } err = core.UnmarshalModel(m, "network_interface_count", &obj.NetworkInterfaceCount, UnmarshalInstanceProfileNetworkInterfaceCount) if err != nil { return @@ -48235,6 +51901,54 @@ func UnmarshalInstanceProfileNumaCount(m map[string]json.RawMessage, result inte return } +// InstanceProfileNetworkAttachmentCount : InstanceProfileNetworkAttachmentCount struct +// Models which "extend" this model: +// - InstanceProfileNetworkAttachmentCountRange +// - InstanceProfileNetworkAttachmentCountDependent +type InstanceProfileNetworkAttachmentCount struct { + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The type for this profile field. + Type *string `json:"type,omitempty"` +} + +// Constants associated with the InstanceProfileNetworkAttachmentCount.Type property. +// The type for this profile field. +const ( + InstanceProfileNetworkAttachmentCountTypeRangeConst = "range" +) + +func (*InstanceProfileNetworkAttachmentCount) isaInstanceProfileNetworkAttachmentCount() bool { + return true +} + +type InstanceProfileNetworkAttachmentCountIntf interface { + isaInstanceProfileNetworkAttachmentCount() bool +} + +// UnmarshalInstanceProfileNetworkAttachmentCount unmarshals an instance of InstanceProfileNetworkAttachmentCount from the specified map of raw messages. +func UnmarshalInstanceProfileNetworkAttachmentCount(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileNetworkAttachmentCount) + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // InstanceProfileNetworkInterfaceCount : InstanceProfileNetworkInterfaceCount struct // Models which "extend" this model: // - InstanceProfileNetworkInterfaceCountRange @@ -48686,7 +52400,7 @@ type InstancePrototype struct { // The VPC this virtual server instance will reside in. // // If specified, it must match the VPC for the subnets of the instance network - // interfaces. + // attachments or instance network interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -48704,6 +52418,12 @@ type InstancePrototype struct { // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone,omitempty"` + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering // or offering version to use when provisioning this virtual server instance. // @@ -48797,6 +52517,14 @@ func UnmarshalInstancePrototype(m map[string]json.RawMessage, result interface{} if err != nil { return } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) if err != nil { return @@ -48996,7 +52724,7 @@ type InstanceTemplate struct { // The VPC this virtual server instance will reside in. // // If specified, it must match the VPC for the subnets of the instance network - // interfaces. + // attachments or instance network interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -49014,6 +52742,12 @@ type InstanceTemplate struct { // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone,omitempty"` + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering // or offering version to use when provisioning this virtual server instance. // @@ -49120,6 +52854,14 @@ func UnmarshalInstanceTemplate(m map[string]json.RawMessage, result interface{}) if err != nil { return } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) if err != nil { return @@ -49346,7 +53088,7 @@ type InstanceTemplatePrototype struct { // The VPC this virtual server instance will reside in. // // If specified, it must match the VPC for the subnets of the instance network - // interfaces. + // attachments or instance network interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -49364,6 +53106,12 @@ type InstanceTemplatePrototype struct { // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone,omitempty"` + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) // offering version to use when provisioning this virtual server instance. // If an offering is specified, the latest version of that offering will be used. @@ -49458,6 +53206,14 @@ func UnmarshalInstanceTemplatePrototype(m map[string]json.RawMessage, result int if err != nil { return } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) if err != nil { return @@ -50190,6 +53946,52 @@ func (options *ListBareMetalServerDisksOptions) SetHeaders(param map[string]stri return options } +// ListBareMetalServerNetworkAttachmentsOptions : The ListBareMetalServerNetworkAttachments options. +type ListBareMetalServerNetworkAttachmentsOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_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"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListBareMetalServerNetworkAttachmentsOptions : Instantiate ListBareMetalServerNetworkAttachmentsOptions +func (*VpcV1) NewListBareMetalServerNetworkAttachmentsOptions(bareMetalServerID string) *ListBareMetalServerNetworkAttachmentsOptions { + return &ListBareMetalServerNetworkAttachmentsOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *ListBareMetalServerNetworkAttachmentsOptions) SetBareMetalServerID(bareMetalServerID string) *ListBareMetalServerNetworkAttachmentsOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListBareMetalServerNetworkAttachmentsOptions) SetStart(start string) *ListBareMetalServerNetworkAttachmentsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListBareMetalServerNetworkAttachmentsOptions) SetLimit(limit int64) *ListBareMetalServerNetworkAttachmentsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListBareMetalServerNetworkAttachmentsOptions) SetHeaders(param map[string]string) *ListBareMetalServerNetworkAttachmentsOptions { + options.Headers = param + return options +} + // ListBareMetalServerNetworkInterfaceFloatingIpsOptions : The ListBareMetalServerNetworkInterfaceFloatingIps options. type ListBareMetalServerNetworkInterfaceFloatingIpsOptions struct { // The bare metal server identifier. @@ -50796,6 +54598,18 @@ type ListFloatingIpsOptions struct { // in descending order, and the value `name` sorts it by the `name` property in ascending order. Sort *string `json:"sort,omitempty"` + // Filters the collection to resources with a `target.id` property matching the specified identifier. + TargetID *string `json:"target.id,omitempty"` + + // Filters the collection to resources with a `target.crn` property matching the specified CRN. + TargetCRN *string `json:"target.crn,omitempty"` + + // Filters the collection to resources with a `target.name` property matching the exact specified name. + TargetName *string `json:"target.name,omitempty"` + + // Filters the collection to resources with a `target.resource_type` property matching the specified value. + TargetResourceType *string `json:"target.resource_type,omitempty"` + // Allows users to set headers on API requests Headers map[string]string } @@ -50838,6 +54652,30 @@ func (_options *ListFloatingIpsOptions) SetSort(sort string) *ListFloatingIpsOpt return _options } +// SetTargetID : Allow user to set TargetID +func (_options *ListFloatingIpsOptions) SetTargetID(targetID string) *ListFloatingIpsOptions { + _options.TargetID = core.StringPtr(targetID) + return _options +} + +// SetTargetCRN : Allow user to set TargetCRN +func (_options *ListFloatingIpsOptions) SetTargetCRN(targetCRN string) *ListFloatingIpsOptions { + _options.TargetCRN = core.StringPtr(targetCRN) + return _options +} + +// SetTargetName : Allow user to set TargetName +func (_options *ListFloatingIpsOptions) SetTargetName(targetName string) *ListFloatingIpsOptions { + _options.TargetName = core.StringPtr(targetName) + return _options +} + +// SetTargetResourceType : Allow user to set TargetResourceType +func (_options *ListFloatingIpsOptions) SetTargetResourceType(targetResourceType string) *ListFloatingIpsOptions { + _options.TargetResourceType = core.StringPtr(targetResourceType) + return _options +} + // SetHeaders : Allow user to set Headers func (options *ListFloatingIpsOptions) SetHeaders(param map[string]string) *ListFloatingIpsOptions { options.Headers = param @@ -51398,6 +55236,34 @@ func (options *ListInstanceGroupsOptions) SetHeaders(param map[string]string) *L return options } +// ListInstanceNetworkAttachmentsOptions : The ListInstanceNetworkAttachments options. +type ListInstanceNetworkAttachmentsOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListInstanceNetworkAttachmentsOptions : Instantiate ListInstanceNetworkAttachmentsOptions +func (*VpcV1) NewListInstanceNetworkAttachmentsOptions(instanceID string) *ListInstanceNetworkAttachmentsOptions { + return &ListInstanceNetworkAttachmentsOptions{ + InstanceID: core.StringPtr(instanceID), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *ListInstanceNetworkAttachmentsOptions) SetInstanceID(instanceID string) *ListInstanceNetworkAttachmentsOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceNetworkAttachmentsOptions) SetHeaders(param map[string]string) *ListInstanceNetworkAttachmentsOptions { + options.Headers = param + return options +} + // ListInstanceNetworkInterfaceFloatingIpsOptions : The ListInstanceNetworkInterfaceFloatingIps options. type ListInstanceNetworkInterfaceFloatingIpsOptions struct { // The virtual server instance identifier. @@ -52175,6 +56041,74 @@ func (options *ListNetworkAclsOptions) SetHeaders(param map[string]string) *List return options } +// ListNetworkInterfaceFloatingIpsOptions : The ListNetworkInterfaceFloatingIps options. +type ListNetworkInterfaceFloatingIpsOptions struct { + // The virtual network interface identifier. + VirtualNetworkInterfaceID *string `json:"virtual_network_interface_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 + // `-name` sorts the collection by the `name` 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 ListNetworkInterfaceFloatingIpsOptions.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 +// `-name` sorts the collection by the `name` property in descending order, and the value `name` sorts it by the `name` +// property in ascending order. +const ( + ListNetworkInterfaceFloatingIpsOptionsSortAddressConst = "address" + ListNetworkInterfaceFloatingIpsOptionsSortNameConst = "name" +) + +// NewListNetworkInterfaceFloatingIpsOptions : Instantiate ListNetworkInterfaceFloatingIpsOptions +func (*VpcV1) NewListNetworkInterfaceFloatingIpsOptions(virtualNetworkInterfaceID string) *ListNetworkInterfaceFloatingIpsOptions { + return &ListNetworkInterfaceFloatingIpsOptions{ + VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID), + } +} + +// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID +func (_options *ListNetworkInterfaceFloatingIpsOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *ListNetworkInterfaceFloatingIpsOptions { + _options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListNetworkInterfaceFloatingIpsOptions) SetStart(start string) *ListNetworkInterfaceFloatingIpsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListNetworkInterfaceFloatingIpsOptions) SetLimit(limit int64) *ListNetworkInterfaceFloatingIpsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListNetworkInterfaceFloatingIpsOptions) SetSort(sort string) *ListNetworkInterfaceFloatingIpsOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListNetworkInterfaceFloatingIpsOptions) SetHeaders(param map[string]string) *ListNetworkInterfaceFloatingIpsOptions { + options.Headers = param + return options +} + // ListOperatingSystemsOptions : The ListOperatingSystems options. type ListOperatingSystemsOptions struct { // A server-provided token determining what resource to start the page on. @@ -53050,6 +56984,18 @@ type ListSubnetReservedIpsOptions struct { // in descending order, and the value `name` sorts it by the `name` property in ascending order. Sort *string `json:"sort,omitempty"` + // Filters the collection to resources with a `target.id` property matching the specified identifier. + TargetID *string `json:"target.id,omitempty"` + + // Filters the collection to resources with a `target.crn` property matching the specified CRN. + TargetCRN *string `json:"target.crn,omitempty"` + + // Filters the collection to resources with a `target.name` property matching the exact specified name. + TargetName *string `json:"target.name,omitempty"` + + // Filters the collection to resources with a `target.resource_type` property matching the specified value. + TargetResourceType *string `json:"target.resource_type,omitempty"` + // Allows users to set headers on API requests Headers map[string]string } @@ -53095,6 +57041,30 @@ func (_options *ListSubnetReservedIpsOptions) SetSort(sort string) *ListSubnetRe return _options } +// SetTargetID : Allow user to set TargetID +func (_options *ListSubnetReservedIpsOptions) SetTargetID(targetID string) *ListSubnetReservedIpsOptions { + _options.TargetID = core.StringPtr(targetID) + return _options +} + +// SetTargetCRN : Allow user to set TargetCRN +func (_options *ListSubnetReservedIpsOptions) SetTargetCRN(targetCRN string) *ListSubnetReservedIpsOptions { + _options.TargetCRN = core.StringPtr(targetCRN) + return _options +} + +// SetTargetName : Allow user to set TargetName +func (_options *ListSubnetReservedIpsOptions) SetTargetName(targetName string) *ListSubnetReservedIpsOptions { + _options.TargetName = core.StringPtr(targetName) + return _options +} + +// SetTargetResourceType : Allow user to set TargetResourceType +func (_options *ListSubnetReservedIpsOptions) SetTargetResourceType(targetResourceType string) *ListSubnetReservedIpsOptions { + _options.TargetResourceType = core.StringPtr(targetResourceType) + return _options +} + // SetHeaders : Allow user to set Headers func (options *ListSubnetReservedIpsOptions) SetHeaders(param map[string]string) *ListSubnetReservedIpsOptions { options.Headers = param @@ -53199,6 +57169,74 @@ func (options *ListSubnetsOptions) SetHeaders(param map[string]string) *ListSubn return options } +// ListVirtualNetworkInterfaceIpsOptions : The ListVirtualNetworkInterfaceIps options. +type ListVirtualNetworkInterfaceIpsOptions struct { + // The virtual network interface identifier. + VirtualNetworkInterfaceID *string `json:"virtual_network_interface_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 + // `-name` sorts the collection by the `name` 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 ListVirtualNetworkInterfaceIpsOptions.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 +// `-name` sorts the collection by the `name` property in descending order, and the value `name` sorts it by the `name` +// property in ascending order. +const ( + ListVirtualNetworkInterfaceIpsOptionsSortAddressConst = "address" + ListVirtualNetworkInterfaceIpsOptionsSortNameConst = "name" +) + +// NewListVirtualNetworkInterfaceIpsOptions : Instantiate ListVirtualNetworkInterfaceIpsOptions +func (*VpcV1) NewListVirtualNetworkInterfaceIpsOptions(virtualNetworkInterfaceID string) *ListVirtualNetworkInterfaceIpsOptions { + return &ListVirtualNetworkInterfaceIpsOptions{ + VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID), + } +} + +// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID +func (_options *ListVirtualNetworkInterfaceIpsOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *ListVirtualNetworkInterfaceIpsOptions { + _options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListVirtualNetworkInterfaceIpsOptions) SetStart(start string) *ListVirtualNetworkInterfaceIpsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListVirtualNetworkInterfaceIpsOptions) SetLimit(limit int64) *ListVirtualNetworkInterfaceIpsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListVirtualNetworkInterfaceIpsOptions) SetSort(sort string) *ListVirtualNetworkInterfaceIpsOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVirtualNetworkInterfaceIpsOptions) SetHeaders(param map[string]string) *ListVirtualNetworkInterfaceIpsOptions { + options.Headers = param + return options +} + // ListVirtualNetworkInterfacesOptions : The ListVirtualNetworkInterfaces options. type ListVirtualNetworkInterfacesOptions struct { // A server-provided token determining what resource to start the page on. @@ -54666,7 +58704,7 @@ type LoadBalancerListener struct { CertificateInstance *CertificateInstanceReference `json:"certificate_instance,omitempty"` // The connection limit of the listener. - ConnectionLimit *int64 `json:"connection_limit,omitempty"` + ConnectionLimit *int64 `json:"connection_limit" validate:"required"` // The date and time that this listener was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -55378,7 +59416,9 @@ type LoadBalancerListenerPolicyReference struct { // The policy's unique identifier. ID *string `json:"id" validate:"required"` - Name interface{} `json:"name" validate:"required"` + // The name for this load balancer listener policy. The name is unique across all policies for the load balancer + // listener. + Name *string `json:"name" validate:"required"` } // UnmarshalLoadBalancerListenerPolicyReference unmarshals an instance of LoadBalancerListenerPolicyReference from the specified map of raw messages. @@ -59341,24 +63381,56 @@ func UnmarshalNetworkACLRuleReferenceDeleted(m map[string]json.RawMessage, resul // NetworkInterface : NetworkInterface struct type NetworkInterface struct { // Indicates whether source IP spoofing is allowed on this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and source IP spoofing is managed on the attached virtual + // network interface. AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"` // The date and time that the instance network interface was created. + // + // If this instance has network attachments, this network interface was created as a [read-only + // representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) when its corresponding network attachment + // was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` // The floating IPs associated with this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the floating IPs are associated with the attached virtual + // network interface. FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` // The URL for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href" validate:"required"` // The unique identifier for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the identifier is that of the corresponding network + // attachment. ID *string `json:"id" validate:"required"` // The name for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the name matches its corresponding network attachment. Name *string `json:"name" validate:"required"` // The instance network interface port speed in Mbps. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the port speed is that of its corresponding network + // attachment. PortSpeed *int64 `json:"port_speed" validate:"required"` PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` @@ -59367,15 +63439,28 @@ type NetworkInterface struct { ResourceType *string `json:"resource_type" validate:"required"` // The security groups targeting this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the security groups are associated with the attached + // virtual network interface. SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` // The status of the instance network interface. + // + // If this instance has network attachments, this network interface is a read-only representation of its corresponding + // network attachment and its attached virtual network interface, and the status is [computed from + // them](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients). Status *string `json:"status" validate:"required"` // The associated subnet. Subnet *SubnetReference `json:"subnet" validate:"required"` // The instance network interface type. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the type is that of its corresponding network attachment. Type *string `json:"type" validate:"required"` } @@ -59387,6 +63472,10 @@ const ( // Constants associated with the NetworkInterface.Status property. // The status of the instance network interface. +// +// If this instance has network attachments, this network interface is a read-only representation of its corresponding +// network attachment and its attached virtual network interface, and the status is [computed from +// them](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients). const ( NetworkInterfaceStatusAvailableConst = "available" NetworkInterfaceStatusDeletingConst = "deleting" @@ -59396,6 +63485,10 @@ const ( // Constants associated with the NetworkInterface.Type property. // The instance network interface type. +// +// If this instance has network attachments, this network interface is a +// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network +// attachment and its attached virtual network interface, and the type is that of its corresponding network attachment. const ( NetworkInterfaceTypePrimaryConst = "primary" NetworkInterfaceTypeSecondaryConst = "secondary" @@ -59467,9 +63560,18 @@ type NetworkInterfaceBareMetalServerContextReference struct { Deleted *NetworkInterfaceBareMetalServerContextReferenceDeleted `json:"deleted,omitempty"` // The URL for this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href" validate:"required"` // The unique identifier for this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the identifier is that of the corresponding network + // attachment. ID *string `json:"id" validate:"required"` // The name for this bare metal server network interface. @@ -59611,9 +63713,18 @@ type NetworkInterfaceInstanceContextReference struct { Deleted *NetworkInterfaceInstanceContextReferenceDeleted `json:"deleted,omitempty"` // The URL for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href" validate:"required"` // The unique identifier for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the identifier is that of the corresponding network + // attachment. ID *string `json:"id" validate:"required"` // The name for this instance network interface. @@ -59690,6 +63801,11 @@ func UnmarshalNetworkInterfaceInstanceContextReferenceDeleted(m map[string]json. // NetworkInterfacePatch : NetworkInterfacePatch struct type NetworkInterfacePatch struct { // Indicates whether source IP spoofing is allowed on this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and source IP spoofing is managed on the attached virtual + // network interface. AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` // The name for the instance network interface. The name must not be used by another network interface on the virtual @@ -59725,6 +63841,11 @@ func (networkInterfacePatch *NetworkInterfacePatch) AsPatch() (_patch map[string // NetworkInterfacePrototype : NetworkInterfacePrototype struct type NetworkInterfacePrototype struct { // Indicates whether source IP spoofing is allowed on this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and source IP spoofing is managed on the attached virtual + // network interface. AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` // The name for the instance network interface. The name must not be used by another network interface on the virtual @@ -61018,6 +65139,82 @@ func (options *RemoveInstanceNetworkInterfaceFloatingIPOptions) SetHeaders(param return options } +// RemoveNetworkInterfaceFloatingIPOptions : The RemoveNetworkInterfaceFloatingIP options. +type RemoveNetworkInterfaceFloatingIPOptions struct { + // The virtual network interface identifier. + VirtualNetworkInterfaceID *string `json:"virtual_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 +} + +// NewRemoveNetworkInterfaceFloatingIPOptions : Instantiate RemoveNetworkInterfaceFloatingIPOptions +func (*VpcV1) NewRemoveNetworkInterfaceFloatingIPOptions(virtualNetworkInterfaceID string, id string) *RemoveNetworkInterfaceFloatingIPOptions { + return &RemoveNetworkInterfaceFloatingIPOptions{ + VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID), + ID: core.StringPtr(id), + } +} + +// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID +func (_options *RemoveNetworkInterfaceFloatingIPOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *RemoveNetworkInterfaceFloatingIPOptions { + _options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *RemoveNetworkInterfaceFloatingIPOptions) SetID(id string) *RemoveNetworkInterfaceFloatingIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *RemoveNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *RemoveNetworkInterfaceFloatingIPOptions { + options.Headers = param + return options +} + +// RemoveVirtualNetworkInterfaceIPOptions : The RemoveVirtualNetworkInterfaceIP options. +type RemoveVirtualNetworkInterfaceIPOptions struct { + // The virtual network interface identifier. + VirtualNetworkInterfaceID *string `json:"virtual_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 +} + +// NewRemoveVirtualNetworkInterfaceIPOptions : Instantiate RemoveVirtualNetworkInterfaceIPOptions +func (*VpcV1) NewRemoveVirtualNetworkInterfaceIPOptions(virtualNetworkInterfaceID string, id string) *RemoveVirtualNetworkInterfaceIPOptions { + return &RemoveVirtualNetworkInterfaceIPOptions{ + VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID), + ID: core.StringPtr(id), + } +} + +// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID +func (_options *RemoveVirtualNetworkInterfaceIPOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *RemoveVirtualNetworkInterfaceIPOptions { + _options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *RemoveVirtualNetworkInterfaceIPOptions) SetID(id string) *RemoveVirtualNetworkInterfaceIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *RemoveVirtualNetworkInterfaceIPOptions) SetHeaders(param map[string]string) *RemoveVirtualNetworkInterfaceIPOptions { + options.Headers = param + return options +} + // RemoveVPNGatewayConnectionLocalCIDROptions : The RemoveVPNGatewayConnectionLocalCIDR options. type RemoveVPNGatewayConnectionLocalCIDROptions struct { // The VPN gateway identifier. @@ -61728,6 +65925,98 @@ func UnmarshalReservedIPCollectionNext(m map[string]json.RawMessage, result inte return } +// ReservedIPCollectionVirtualNetworkInterfaceContext : ReservedIPCollectionVirtualNetworkInterfaceContext struct +type ReservedIPCollectionVirtualNetworkInterfaceContext struct { + // A link to the first page of resources. + First *ReservedIPCollectionVirtualNetworkInterfaceContextFirst `json:"first" validate:"required"` + + // Collection of reserved IPs bound to the virtual network interface specified by the identifier in the URL. + Ips []ReservedIPReference `json:"ips" 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 *ReservedIPCollectionVirtualNetworkInterfaceContextNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalReservedIPCollectionVirtualNetworkInterfaceContext unmarshals an instance of ReservedIPCollectionVirtualNetworkInterfaceContext from the specified map of raw messages. +func UnmarshalReservedIPCollectionVirtualNetworkInterfaceContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPCollectionVirtualNetworkInterfaceContext) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalReservedIPCollectionVirtualNetworkInterfaceContextFirst) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalReservedIPCollectionVirtualNetworkInterfaceContextNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + 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 *ReservedIPCollectionVirtualNetworkInterfaceContext) 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 +} + +// ReservedIPCollectionVirtualNetworkInterfaceContextFirst : A link to the first page of resources. +type ReservedIPCollectionVirtualNetworkInterfaceContextFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalReservedIPCollectionVirtualNetworkInterfaceContextFirst unmarshals an instance of ReservedIPCollectionVirtualNetworkInterfaceContextFirst from the specified map of raw messages. +func UnmarshalReservedIPCollectionVirtualNetworkInterfaceContextFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPCollectionVirtualNetworkInterfaceContextFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPCollectionVirtualNetworkInterfaceContextNext : A link to the next page of resources. This property is present for all pages except the last page. +type ReservedIPCollectionVirtualNetworkInterfaceContextNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalReservedIPCollectionVirtualNetworkInterfaceContextNext unmarshals an instance of ReservedIPCollectionVirtualNetworkInterfaceContextNext from the specified map of raw messages. +func UnmarshalReservedIPCollectionVirtualNetworkInterfaceContextNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPCollectionVirtualNetworkInterfaceContextNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // ReservedIPPatch : ReservedIPPatch struct type ReservedIPPatch struct { // Indicates whether this reserved IP member will be automatically deleted when either @@ -61927,12 +66216,14 @@ func UnmarshalReservedIPTarget(m map[string]json.RawMessage, result interface{}) // ReservedIPTargetPrototype : The target to bind this reserved IP to. The target must be in the same VPC. // -// At present, only endpoint gateway targets are supported. The endpoint gateway must not be already bound to a -// reserved IP in the subnet's zone. +// The following targets are supported: +// - An endpoint gateway not already bound to a reserved IP in the subnet's zone. +// - A virtual network interface. // // If unspecified, the reserved IP will be created unbound. // Models which "extend" this model: // - ReservedIPTargetPrototypeEndpointGatewayIdentity +// - ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity type ReservedIPTargetPrototype struct { // The unique identifier for this endpoint gateway. ID *string `json:"id,omitempty"` @@ -62084,6 +66375,10 @@ type Route struct { // - `drop`: drop the packet. Action *string `json:"action" validate:"required"` + // Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` + // routing table property. + Advertise *bool `json:"advertise" validate:"required"` + // The date and time that the route was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -62177,6 +66472,10 @@ func UnmarshalRoute(m map[string]json.RawMessage, result interface{}) (err error if err != nil { return } + err = core.UnmarshalPrimitive(m, "advertise", &obj.Advertise) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return @@ -62418,6 +66717,10 @@ type RouteCollectionVPCContextRoutesItem struct { // - `drop`: drop the packet. Action *string `json:"action" validate:"required"` + // Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` + // routing table property. + Advertise *bool `json:"advertise" validate:"required"` + // The date and time that the route was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -62511,6 +66814,10 @@ func UnmarshalRouteCollectionVPCContextRoutesItem(m map[string]json.RawMessage, if err != nil { return } + err = core.UnmarshalPrimitive(m, "advertise", &obj.Advertise) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return @@ -62757,6 +67064,15 @@ func UnmarshalRouteNextHopPatch(m map[string]json.RawMessage, result interface{} // RoutePatch : RoutePatch struct type RoutePatch struct { + // Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` + // routing table property. + // + // Since all routes in a routing table with the same `destination` and `zone` must have the same `advertise` value, + // this property can only be changed for routes with a unique + // `destination` and `zone` in the routing table. For more information, see [Advertising + // routes](https://cloud.ibm.com/docs/vpc?topic=vpc-about-custom-routes#rt-advertising-routes). + Advertise *bool `json:"advertise,omitempty"` + // The name for this route. The name must not be used by another route in the routing table. Names starting with `ibm-` // are reserved for system-provided routes, and are not allowed. Name *string `json:"name,omitempty"` @@ -62779,6 +67095,10 @@ type RoutePatch struct { // UnmarshalRoutePatch unmarshals an instance of RoutePatch from the specified map of raw messages. func UnmarshalRoutePatch(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(RoutePatch) + err = core.UnmarshalPrimitive(m, "advertise", &obj.Advertise) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return @@ -62814,6 +67134,13 @@ type RoutePrototype struct { // - `drop`: drop the packet. Action *string `json:"action,omitempty"` + // Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` + // routing table property. + // + // All routes in a routing table with the same `destination` and `zone` must have the same + // `advertise` value. + Advertise *bool `json:"advertise,omitempty"` + // The destination CIDR of the route. The host identifier in the CIDR must be zero. // // At most two routes per `zone` in a table can have the same `destination` and @@ -62874,6 +67201,10 @@ func UnmarshalRoutePrototype(m map[string]json.RawMessage, result interface{}) ( if err != nil { return } + err = core.UnmarshalPrimitive(m, "advertise", &obj.Advertise) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) if err != nil { return @@ -63013,6 +67344,14 @@ type RoutingTable struct { // support is expected to expand in the future. AcceptRoutesFrom []ResourceFilter `json:"accept_routes_from" validate:"required"` + // The ingress sources to advertise routes to. Routes in the table with `advertise` enabled will be advertised to these + // sources. + // + // 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. + AdvertiseRoutesTo []string `json:"advertise_routes_to" validate:"required"` + // The date and time that this routing table was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -63079,6 +67418,16 @@ type RoutingTable struct { Subnets []SubnetReference `json:"subnets" validate:"required"` } +// Constants associated with the RoutingTable.AdvertiseRoutesTo property. +// An ingress source that routes can be advertised to: +// +// - `direct_link` (requires `route_direct_link_ingress` be set to `true`) +// - `transit_gateway` (requires `route_transit_gateway_ingress` be set to `true`). +const ( + RoutingTableAdvertiseRoutesToDirectLinkConst = "direct_link" + RoutingTableAdvertiseRoutesToTransitGatewayConst = "transit_gateway" +) + // Constants associated with the RoutingTable.LifecycleState property. // The lifecycle state of the routing table. const ( @@ -63104,6 +67453,10 @@ func UnmarshalRoutingTable(m map[string]json.RawMessage, result interface{}) (er if err != nil { return } + err = core.UnmarshalPrimitive(m, "advertise_routes_to", &obj.AdvertiseRoutesTo) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return @@ -63298,6 +67651,10 @@ type RoutingTablePatch struct { // support is expected to expand in the future. AcceptRoutesFrom []ResourceFilter `json:"accept_routes_from,omitempty"` + // The ingress sources to advertise routes to, replacing any existing sources to advertise to. Routes in the table with + // `advertise` enabled will be advertised to these sources. + AdvertiseRoutesTo []string `json:"advertise_routes_to,omitempty"` + // The name for this routing table. The name must not be used by another routing table in the VPC. Name *string `json:"name,omitempty"` @@ -63305,7 +67662,8 @@ type RoutingTablePatch struct { // [Direct Link](https://cloud.ibm.com/docs/dl/) to this VPC. Updating to `true` selects this routing table, provided // no other routing table in the VPC already has this property set to `true`, and no subnets are attached to this // routing table. Updating to - // `false` deselects this routing table. + // `false` deselects this routing table, provided `direct_link` is absent from + // `advertise_routes_to`. // // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is @@ -63329,7 +67687,8 @@ type RoutingTablePatch struct { // Indicates whether this routing table is used to route traffic that originates from // [Transit Gateway](https://cloud.ibm.com/docs/transit-gateway) to this VPC. Updating to // `true` selects this routing table, provided no other routing table in the VPC already has this property set to - // `true`, and no subnets are attached to this routing table. Updating to `false` deselects this routing table. + // `true`, and no subnets are attached to this routing table. Updating to `false` deselects this routing table, + // provided `transit_gateway` is absent from `advertise_routes_to`. // // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is @@ -63353,6 +67712,16 @@ type RoutingTablePatch struct { RouteVPCZoneIngress *bool `json:"route_vpc_zone_ingress,omitempty"` } +// Constants associated with the RoutingTablePatch.AdvertiseRoutesTo property. +// An ingress source that routes can be advertised to: +// +// - `direct_link` (requires `route_direct_link_ingress` be set to `true`) +// - `transit_gateway` (requires `route_transit_gateway_ingress` be set to `true`). +const ( + RoutingTablePatchAdvertiseRoutesToDirectLinkConst = "direct_link" + RoutingTablePatchAdvertiseRoutesToTransitGatewayConst = "transit_gateway" +) + // 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) @@ -63360,6 +67729,10 @@ func UnmarshalRoutingTablePatch(m map[string]json.RawMessage, result interface{} if err != nil { return } + err = core.UnmarshalPrimitive(m, "advertise_routes_to", &obj.AdvertiseRoutesTo) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return @@ -64406,9 +68779,18 @@ type SecurityGroupTargetReference struct { Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` // The URL for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href,omitempty"` // The unique identifier for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the identifier is that of the corresponding network + // attachment. ID *string `json:"id,omitempty"` // The name for this instance network interface. @@ -65576,7 +69958,39 @@ func UnmarshalShareMountTargetReferenceDeleted(m map[string]json.RawMessage, res // ShareMountTargetVirtualNetworkInterfacePrototype : ShareMountTargetVirtualNetworkInterfacePrototype struct // Models which "extend" this model: // - ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext +// - ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity type ShareMountTargetVirtualNetworkInterfacePrototype 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 whether this virtual network interface will be automatically deleted when + // `target` is deleted. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - `floating_ips` must not have more than one floating IP. + // + // If `false`: + // - Packets are passed unchanged to/from the virtual network interface, + // allowing the workload to perform any needed NAT operations. + // - `allow_ip_spoofing` must be `false`. + // - Can only be attached to a `target` with a `resource_type` of + // `bare_metal_server_network_attachment`. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` + + // Additional IP addresses to bind to the virtual network interface. Each item may be either a reserved IP identity, or + // a reserved IP prototype object which will be used to create a new reserved IP. All IP addresses must be in the + // primary IP's subnet. + // + // If reserved IP identities are provided, the specified reserved IPs must be unbound. + // + // If reserved IP prototype objects with addresses are provided, the addresses must be available on the virtual network + // interface's subnet. For any prototype objects that do not specify an address, an available address on the subnet + // will be automatically selected and reserved. + Ips []VirtualNetworkInterfaceIPPrototypeIntf `json:"ips,omitempty"` + // The name for this virtual network interface. The name must not be used by another virtual network interface in the // VPC. If unspecified, the name will be a hyphenated list of randomly-selected words. Names beginning with `ibm-` are // reserved for provider-owned resources, and are not allowed. @@ -65604,6 +70018,15 @@ type ShareMountTargetVirtualNetworkInterfacePrototype struct { // The associated subnet. Required if `primary_ip` does not specify a reserved IP // identity. Subnet SubnetIdentityIntf `json:"subnet,omitempty"` + + // The unique identifier for this virtual network interface. + ID *string `json:"id,omitempty"` + + // The URL for this virtual network interface. + Href *string `json:"href,omitempty"` + + // The CRN for this virtual network interface. + CRN *string `json:"crn,omitempty"` } func (*ShareMountTargetVirtualNetworkInterfacePrototype) isaShareMountTargetVirtualNetworkInterfacePrototype() bool { @@ -65617,6 +70040,22 @@ type ShareMountTargetVirtualNetworkInterfacePrototypeIntf interface { // UnmarshalShareMountTargetVirtualNetworkInterfacePrototype unmarshals an instance of ShareMountTargetVirtualNetworkInterfacePrototype from the specified map of raw messages. func UnmarshalShareMountTargetVirtualNetworkInterfacePrototype(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(ShareMountTargetVirtualNetworkInterfacePrototype) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPPrototype) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return @@ -65637,6 +70076,18 @@ func UnmarshalShareMountTargetVirtualNetworkInterfacePrototype(m map[string]json 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 + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -68727,6 +73178,54 @@ func (options *UpdateBareMetalServerDiskOptions) SetHeaders(param map[string]str return options } +// UpdateBareMetalServerNetworkAttachmentOptions : The UpdateBareMetalServerNetworkAttachment options. +type UpdateBareMetalServerNetworkAttachmentOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + + // The bare metal server network attachment identifier. + ID *string `json:"id" validate:"required,ne="` + + // The bare metal server network attachment patch. + BareMetalServerNetworkAttachmentPatch map[string]interface{} `json:"BareMetalServerNetworkAttachment_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateBareMetalServerNetworkAttachmentOptions : Instantiate UpdateBareMetalServerNetworkAttachmentOptions +func (*VpcV1) NewUpdateBareMetalServerNetworkAttachmentOptions(bareMetalServerID string, id string, bareMetalServerNetworkAttachmentPatch map[string]interface{}) *UpdateBareMetalServerNetworkAttachmentOptions { + return &UpdateBareMetalServerNetworkAttachmentOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + ID: core.StringPtr(id), + BareMetalServerNetworkAttachmentPatch: bareMetalServerNetworkAttachmentPatch, + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *UpdateBareMetalServerNetworkAttachmentOptions) SetBareMetalServerID(bareMetalServerID string) *UpdateBareMetalServerNetworkAttachmentOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateBareMetalServerNetworkAttachmentOptions) SetID(id string) *UpdateBareMetalServerNetworkAttachmentOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetBareMetalServerNetworkAttachmentPatch : Allow user to set BareMetalServerNetworkAttachmentPatch +func (_options *UpdateBareMetalServerNetworkAttachmentOptions) SetBareMetalServerNetworkAttachmentPatch(bareMetalServerNetworkAttachmentPatch map[string]interface{}) *UpdateBareMetalServerNetworkAttachmentOptions { + _options.BareMetalServerNetworkAttachmentPatch = bareMetalServerNetworkAttachmentPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateBareMetalServerNetworkAttachmentOptions) SetHeaders(param map[string]string) *UpdateBareMetalServerNetworkAttachmentOptions { + options.Headers = param + return options +} + // UpdateBareMetalServerNetworkInterfaceOptions : The UpdateBareMetalServerNetworkInterface options. type UpdateBareMetalServerNetworkInterfaceOptions struct { // The bare metal server identifier. @@ -69473,6 +73972,54 @@ func (options *UpdateInstanceGroupOptions) SetHeaders(param map[string]string) * return options } +// UpdateInstanceNetworkAttachmentOptions : The UpdateInstanceNetworkAttachment options. +type UpdateInstanceNetworkAttachmentOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The instance network attachment identifier. + ID *string `json:"id" validate:"required,ne="` + + // The instance network attachment patch. + InstanceNetworkAttachmentPatch map[string]interface{} `json:"InstanceNetworkAttachment_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateInstanceNetworkAttachmentOptions : Instantiate UpdateInstanceNetworkAttachmentOptions +func (*VpcV1) NewUpdateInstanceNetworkAttachmentOptions(instanceID string, id string, instanceNetworkAttachmentPatch map[string]interface{}) *UpdateInstanceNetworkAttachmentOptions { + return &UpdateInstanceNetworkAttachmentOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + InstanceNetworkAttachmentPatch: instanceNetworkAttachmentPatch, + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *UpdateInstanceNetworkAttachmentOptions) SetInstanceID(instanceID string) *UpdateInstanceNetworkAttachmentOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateInstanceNetworkAttachmentOptions) SetID(id string) *UpdateInstanceNetworkAttachmentOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetInstanceNetworkAttachmentPatch : Allow user to set InstanceNetworkAttachmentPatch +func (_options *UpdateInstanceNetworkAttachmentOptions) SetInstanceNetworkAttachmentPatch(instanceNetworkAttachmentPatch map[string]interface{}) *UpdateInstanceNetworkAttachmentOptions { + _options.InstanceNetworkAttachmentPatch = instanceNetworkAttachmentPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateInstanceNetworkAttachmentOptions) SetHeaders(param map[string]string) *UpdateInstanceNetworkAttachmentOptions { + options.Headers = param + return options +} + // UpdateInstanceNetworkInterfaceOptions : The UpdateInstanceNetworkInterface options. type UpdateInstanceNetworkInterfaceOptions struct { // The virtual server instance identifier. @@ -75273,6 +79820,10 @@ func (vpnServerRoutePatch *VPNServerRoutePatch) AsPatch() (_patch map[string]int // VirtualNetworkInterface : VirtualNetworkInterface struct type VirtualNetworkInterface 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"` + // Indicates whether this virtual network interface will be automatically deleted when // `target` is deleted. AutoDelete *bool `json:"auto_delete" validate:"required"` @@ -75283,15 +79834,35 @@ type VirtualNetworkInterface struct { // The CRN for this virtual network interface. CRN *string `json:"crn" validate:"required"` + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - `floating_ips` must not have more than one floating IP. + // + // If `false`: + // - Packets are passed unchanged to/from the virtual network interface, + // allowing the workload to perform any needed NAT operations. + // - `allow_ip_spoofing` must be `false`. + // - Can only be attached to a `target` with a `resource_type` of + // `bare_metal_server_network_attachment`. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` + // The URL for this virtual network interface. Href *string `json:"href" validate:"required"` // The unique identifier for this virtual network interface. ID *string `json:"id" validate:"required"` + // The reserved IPs bound to this virtual network interface. + // + // May be empty when `lifecycle_state` is `pending`. + Ips []ReservedIPReference `json:"ips" validate:"required"` + // The lifecycle state of the virtual network interface. LifecycleState *string `json:"lifecycle_state" validate:"required"` + // The MAC address of the virtual network interface. May be absent if `lifecycle_state` is `pending`. + MacAddress *string `json:"mac_address,omitempty"` + // The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. Name *string `json:"name" validate:"required"` @@ -75343,6 +79914,10 @@ const ( // UnmarshalVirtualNetworkInterface unmarshals an instance of VirtualNetworkInterface from the specified map of raw messages. func UnmarshalVirtualNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(VirtualNetworkInterface) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) if err != nil { return @@ -75355,6 +79930,10 @@ func UnmarshalVirtualNetworkInterface(m map[string]json.RawMessage, result inter if err != nil { return } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -75363,10 +79942,18 @@ func UnmarshalVirtualNetworkInterface(m map[string]json.RawMessage, result inter if err != nil { return } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIPReference) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) if err != nil { return } + err = core.UnmarshalPrimitive(m, "mac_address", &obj.MacAddress) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return @@ -75499,15 +80086,110 @@ func UnmarshalVirtualNetworkInterfaceCollectionNext(m map[string]json.RawMessage return } +// VirtualNetworkInterfaceIPPrototype : VirtualNetworkInterfaceIPPrototype struct +// Models which "extend" this model: +// - VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext +// - VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext +type VirtualNetworkInterfaceIPPrototype struct { + // The unique identifier for this reserved IP. + ID *string `json:"id,omitempty"` + + // The URL for this reserved IP. + Href *string `json:"href,omitempty"` + + // The IP address to reserve, which must not already be reserved on the subnet. + // + // If unspecified, an available address on the subnet will automatically be selected. + Address *string `json:"address,omitempty"` + + // Indicates whether this reserved IP member will be automatically deleted when either + // `target` is deleted, or the reserved IP is unbound. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // The name for this reserved IP. The name must not be used by another reserved IP in the subnet. Names starting with + // `ibm-` are reserved for provider-owned resources, and are not allowed. If unspecified, the name will be a hyphenated + // list of randomly-selected words. + Name *string `json:"name,omitempty"` +} + +func (*VirtualNetworkInterfaceIPPrototype) isaVirtualNetworkInterfaceIPPrototype() bool { + return true +} + +type VirtualNetworkInterfaceIPPrototypeIntf interface { + isaVirtualNetworkInterfaceIPPrototype() bool +} + +// UnmarshalVirtualNetworkInterfaceIPPrototype unmarshals an instance of VirtualNetworkInterfaceIPPrototype from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceIPPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceIPPrototype) + 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, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // VirtualNetworkInterfacePatch : VirtualNetworkInterfacePatch struct type VirtualNetworkInterfacePatch struct { - // The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. + // Indicates whether source IP spoofing is allowed on this interface. + // + // Must be `false` if `target` is a file share mount target. + AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` + + // Indicates whether this virtual network interface will be automatically deleted when + // `target` is deleted. Must be `false` if the virtual network interface is unbound. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - `floating_ips` must not have more than one floating IP. + // + // If `false`: + // - Packets are passed unchanged to/from the virtual network interface, + // allowing the workload to perform any needed NAT operations. + // - `allow_ip_spoofing` must be `false`. + // - Can only be attached to a `target` with a `resource_type` of + // `bare_metal_server_network_attachment`. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` + + // The name for this virtual network interface. The name must not be used by another virtual network interface in the + // region. Names beginning with `ibm-` are reserved for provider-owned resources, and are not allowed. Name *string `json:"name,omitempty"` } // UnmarshalVirtualNetworkInterfacePatch unmarshals an instance of VirtualNetworkInterfacePatch from the specified map of raw messages. func UnmarshalVirtualNetworkInterfacePatch(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(VirtualNetworkInterfacePatch) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + 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 @@ -75663,6 +80345,8 @@ func UnmarshalVirtualNetworkInterfaceReferenceDeleted(m map[string]json.RawMessa // types. Optionally halt processing and surface an error, or bypass resources of unrecognized types. // Models which "extend" this model: // - VirtualNetworkInterfaceTargetShareMountTargetReference +// - VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext +// - VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext type VirtualNetworkInterfaceTarget struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. @@ -78551,119 +83235,100 @@ func UnmarshalBareMetalServerInitializationUserAccountBareMetalServerInitializat return } -// BareMetalServerNetworkInterfaceByHiperSocket : BareMetalServerNetworkInterfaceByHiperSocket struct -// This model "extends" BareMetalServerNetworkInterface -type BareMetalServerNetworkInterfaceByHiperSocket struct { - // Indicates whether source IP spoofing is allowed on this bare metal server network interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"` - - // The date and time that the bare metal server network interface was created. +// BareMetalServerNetworkAttachmentByPci : BareMetalServerNetworkAttachmentByPci struct +// This model "extends" BareMetalServerNetworkAttachment +type BareMetalServerNetworkAttachmentByPci struct { + // The date and time that the bare metal server network attachment was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - // If `true`: - // - The VPC infrastructure performs any needed NAT operations. - // - `floating_ips` must not have more than one floating IP. - // - // If `false`: - // - Packets are passed unchanged to/from the bare metal server network interface, - // allowing the workload to perform any needed NAT operations. - // - `allow_ip_spoofing` must be `false`. - // - `interface_type` must not be `hipersocket`. - EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` - - // The floating IPs associated with this bare metal server network interface. - FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` - - // The URL for this bare metal server network interface. + // The URL for this bare metal server network attachment. Href *string `json:"href" validate:"required"` - // The unique identifier for this bare metal server network interface. + // The unique identifier for this bare metal server network attachment. ID *string `json:"id" validate:"required"` - // The MAC address of this bare metal server network interface. If the MAC address has not yet been selected, the value - // will be an empty string. - MacAddress *string `json:"mac_address" validate:"required"` + // The lifecycle state of the bare metal server network attachment. + LifecycleState *string `json:"lifecycle_state" validate:"required"` - // The name for this bare metal server network interface. + // The name for this bare metal server network attachment. The name is unique across all network attachments for the + // bare metal server. Name *string `json:"name" validate:"required"` - // The bare metal server network interface port speed in Mbps. + // The port speed for this bare metal server network attachment in Mbps. PortSpeed *int64 `json:"port_speed" validate:"required"` + // The primary IP address of the virtual network interface for the bare metal server network attachment. PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` // The resource type. ResourceType *string `json:"resource_type" validate:"required"` - // The security groups targeting this bare metal server network interface. - SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` - - // The status of the bare metal server network interface. - Status *string `json:"status" validate:"required"` - - // The associated subnet. + // The subnet of the virtual network interface for the bare metal server network attachment. Subnet *SubnetReference `json:"subnet" validate:"required"` - // The bare metal server network interface type. + // The bare metal server network attachment type. Type *string `json:"type" validate:"required"` - // - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity - // within a `s390x` based system. + // The virtual network interface for this bare metal server network attachment. + VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" validate:"required"` + + // The VLAN IDs allowed for `vlan` attachments using this PCI attachment. + AllowedVlans []int64 `json:"allowed_vlans" validate:"required"` + + // - `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 attachment + // - Cannot directly use an IEEE 802.1Q tag. InterfaceType *string `json:"interface_type" validate:"required"` } -// Constants associated with the BareMetalServerNetworkInterfaceByHiperSocket.ResourceType property. -// The resource type. +// Constants associated with the BareMetalServerNetworkAttachmentByPci.LifecycleState property. +// The lifecycle state of the bare metal server network attachment. const ( - BareMetalServerNetworkInterfaceByHiperSocketResourceTypeNetworkInterfaceConst = "network_interface" + BareMetalServerNetworkAttachmentByPciLifecycleStateDeletingConst = "deleting" + BareMetalServerNetworkAttachmentByPciLifecycleStateFailedConst = "failed" + BareMetalServerNetworkAttachmentByPciLifecycleStatePendingConst = "pending" + BareMetalServerNetworkAttachmentByPciLifecycleStateStableConst = "stable" + BareMetalServerNetworkAttachmentByPciLifecycleStateSuspendedConst = "suspended" + BareMetalServerNetworkAttachmentByPciLifecycleStateUpdatingConst = "updating" + BareMetalServerNetworkAttachmentByPciLifecycleStateWaitingConst = "waiting" ) -// Constants associated with the BareMetalServerNetworkInterfaceByHiperSocket.Status property. -// The status of the bare metal server network interface. +// Constants associated with the BareMetalServerNetworkAttachmentByPci.ResourceType property. +// The resource type. const ( - BareMetalServerNetworkInterfaceByHiperSocketStatusAvailableConst = "available" - BareMetalServerNetworkInterfaceByHiperSocketStatusDeletingConst = "deleting" - BareMetalServerNetworkInterfaceByHiperSocketStatusFailedConst = "failed" - BareMetalServerNetworkInterfaceByHiperSocketStatusPendingConst = "pending" + BareMetalServerNetworkAttachmentByPciResourceTypeBareMetalServerNetworkAttachmentConst = "bare_metal_server_network_attachment" ) -// Constants associated with the BareMetalServerNetworkInterfaceByHiperSocket.Type property. -// The bare metal server network interface type. +// Constants associated with the BareMetalServerNetworkAttachmentByPci.Type property. +// The bare metal server network attachment type. const ( - BareMetalServerNetworkInterfaceByHiperSocketTypePrimaryConst = "primary" - BareMetalServerNetworkInterfaceByHiperSocketTypeSecondaryConst = "secondary" + BareMetalServerNetworkAttachmentByPciTypePrimaryConst = "primary" + BareMetalServerNetworkAttachmentByPciTypeSecondaryConst = "secondary" ) -// Constants associated with the BareMetalServerNetworkInterfaceByHiperSocket.InterfaceType property. -// - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity -// within a `s390x` based system. +// Constants associated with the BareMetalServerNetworkAttachmentByPci.InterfaceType property. +// - `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 attachment +// - Cannot directly use an IEEE 802.1Q tag. const ( - BareMetalServerNetworkInterfaceByHiperSocketInterfaceTypeHipersocketConst = "hipersocket" + BareMetalServerNetworkAttachmentByPciInterfaceTypePciConst = "pci" ) -func (*BareMetalServerNetworkInterfaceByHiperSocket) isaBareMetalServerNetworkInterface() bool { +func (*BareMetalServerNetworkAttachmentByPci) isaBareMetalServerNetworkAttachment() bool { return true } -// UnmarshalBareMetalServerNetworkInterfaceByHiperSocket unmarshals an instance of BareMetalServerNetworkInterfaceByHiperSocket from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfaceByHiperSocket(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfaceByHiperSocket) - err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) - if err != nil { - return - } +// UnmarshalBareMetalServerNetworkAttachmentByPci unmarshals an instance of BareMetalServerNetworkAttachmentByPci from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentByPci(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentByPci) err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return } - err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) - if err != nil { - return - } - err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) - if err != nil { - return - } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -78672,7 +83337,7 @@ func UnmarshalBareMetalServerNetworkInterfaceByHiperSocket(m map[string]json.Raw if err != nil { return } - err = core.UnmarshalPrimitive(m, "mac_address", &obj.MacAddress) + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) if err != nil { return } @@ -78692,19 +83357,19 @@ func UnmarshalBareMetalServerNetworkInterfaceByHiperSocket(m map[string]json.Raw if err != nil { return } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) if err != nil { return } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { return } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext) if err != nil { return } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) if err != nil { return } @@ -78716,177 +83381,207 @@ func UnmarshalBareMetalServerNetworkInterfaceByHiperSocket(m map[string]json.Raw return } -// BareMetalServerNetworkInterfaceByPci : BareMetalServerNetworkInterfaceByPci struct -// This model "extends" BareMetalServerNetworkInterface -type BareMetalServerNetworkInterfaceByPci struct { - // Indicates whether source IP spoofing is allowed on this bare metal server network interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"` - - // The date and time that the bare metal server network interface was created. +// BareMetalServerNetworkAttachmentByVlan : BareMetalServerNetworkAttachmentByVlan struct +// This model "extends" BareMetalServerNetworkAttachment +type BareMetalServerNetworkAttachmentByVlan struct { + // The date and time that the bare metal server network attachment was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - // If `true`: - // - The VPC infrastructure performs any needed NAT operations. - // - `floating_ips` must not have more than one floating IP. - // - // If `false`: - // - Packets are passed unchanged to/from the bare metal server network interface, - // allowing the workload to perform any needed NAT operations. - // - `allow_ip_spoofing` must be `false`. - // - `interface_type` must not be `hipersocket`. - EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` - - // The floating IPs associated with this bare metal server network interface. - FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` - - // The URL for this bare metal server network interface. + // The URL for this bare metal server network attachment. Href *string `json:"href" validate:"required"` - // The unique identifier for this bare metal server network interface. + // The unique identifier for this bare metal server network attachment. ID *string `json:"id" validate:"required"` - // The MAC address of this bare metal server network interface. If the MAC address has not yet been selected, the value - // will be an empty string. - MacAddress *string `json:"mac_address" validate:"required"` + // The lifecycle state of the bare metal server network attachment. + LifecycleState *string `json:"lifecycle_state" validate:"required"` - // The name for this bare metal server network interface. + // The name for this bare metal server network attachment. The name is unique across all network attachments for the + // bare metal server. Name *string `json:"name" validate:"required"` - // The bare metal server network interface port speed in Mbps. + // The port speed for this bare metal server network attachment in Mbps. PortSpeed *int64 `json:"port_speed" validate:"required"` + // The primary IP address of the virtual network interface for the bare metal server network attachment. PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` // The resource type. ResourceType *string `json:"resource_type" validate:"required"` - // The security groups targeting this bare metal server network interface. - SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` - - // The status of the bare metal server network interface. - Status *string `json:"status" validate:"required"` - - // The associated subnet. + // The subnet of the virtual network interface for the bare metal server network attachment. Subnet *SubnetReference `json:"subnet" validate:"required"` - // The bare metal server network interface type. + // The bare metal server network attachment type. Type *string `json:"type" validate:"required"` - // The VLAN IDs allowed for `vlan` interfaces using this PCI interface. - AllowedVlans []int64 `json:"allowed_vlans" validate:"required"` + // The virtual network interface for this bare metal server network attachment. + VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" validate:"required"` - // - `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 tag. + // Indicates if the data path for the network attachment can float to another bare metal server. Can only be `true` for + // network attachments with an `interface_type` of `vlan`. + // + // If `true`, and the network detects traffic for this data path on another bare metal server in the resource group, + // the network attachment will be automatically deleted from this bare metal server and a new network attachment with + // the same `id`, `name` and `vlan` will be created on the other bare metal server. The virtual network interface for + // this network attachment will be automatically be attached to the new network attachment. + // + // For the data path to float, the other bare metal server must be in the same + // `resource_group`, and must have a network attachment with `interface_type` of `pci` with `allowed_vlans` including + // this network attachment's `vlan`. + AllowToFloat *bool `json:"allow_to_float" validate:"required"` + + // - `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. InterfaceType *string `json:"interface_type" validate:"required"` + + // The IEEE 802.1Q VLAN ID that must be used for all traffic on this attachment. + Vlan *int64 `json:"vlan" validate:"required"` } -// Constants associated with the BareMetalServerNetworkInterfaceByPci.ResourceType property. -// The resource type. +// Constants associated with the BareMetalServerNetworkAttachmentByVlan.LifecycleState property. +// The lifecycle state of the bare metal server network attachment. const ( - BareMetalServerNetworkInterfaceByPciResourceTypeNetworkInterfaceConst = "network_interface" + BareMetalServerNetworkAttachmentByVlanLifecycleStateDeletingConst = "deleting" + BareMetalServerNetworkAttachmentByVlanLifecycleStateFailedConst = "failed" + BareMetalServerNetworkAttachmentByVlanLifecycleStatePendingConst = "pending" + BareMetalServerNetworkAttachmentByVlanLifecycleStateStableConst = "stable" + BareMetalServerNetworkAttachmentByVlanLifecycleStateSuspendedConst = "suspended" + BareMetalServerNetworkAttachmentByVlanLifecycleStateUpdatingConst = "updating" + BareMetalServerNetworkAttachmentByVlanLifecycleStateWaitingConst = "waiting" ) -// Constants associated with the BareMetalServerNetworkInterfaceByPci.Status property. -// The status of the bare metal server network interface. +// Constants associated with the BareMetalServerNetworkAttachmentByVlan.ResourceType property. +// The resource type. const ( - BareMetalServerNetworkInterfaceByPciStatusAvailableConst = "available" - BareMetalServerNetworkInterfaceByPciStatusDeletingConst = "deleting" - BareMetalServerNetworkInterfaceByPciStatusFailedConst = "failed" - BareMetalServerNetworkInterfaceByPciStatusPendingConst = "pending" + BareMetalServerNetworkAttachmentByVlanResourceTypeBareMetalServerNetworkAttachmentConst = "bare_metal_server_network_attachment" ) -// Constants associated with the BareMetalServerNetworkInterfaceByPci.Type property. -// The bare metal server network interface type. +// Constants associated with the BareMetalServerNetworkAttachmentByVlan.Type property. +// The bare metal server network attachment type. const ( - BareMetalServerNetworkInterfaceByPciTypePrimaryConst = "primary" - BareMetalServerNetworkInterfaceByPciTypeSecondaryConst = "secondary" + BareMetalServerNetworkAttachmentByVlanTypePrimaryConst = "primary" + BareMetalServerNetworkAttachmentByVlanTypeSecondaryConst = "secondary" ) -// Constants associated with the BareMetalServerNetworkInterfaceByPci.InterfaceType property. -// - `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 tag. +// Constants associated with the BareMetalServerNetworkAttachmentByVlan.InterfaceType property. +// - `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. const ( - BareMetalServerNetworkInterfaceByPciInterfaceTypePciConst = "pci" + BareMetalServerNetworkAttachmentByVlanInterfaceTypeVlanConst = "vlan" ) -func (*BareMetalServerNetworkInterfaceByPci) isaBareMetalServerNetworkInterface() bool { +func (*BareMetalServerNetworkAttachmentByVlan) isaBareMetalServerNetworkAttachment() bool { return true } -// UnmarshalBareMetalServerNetworkInterfaceByPci unmarshals an instance of BareMetalServerNetworkInterfaceByPci from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfaceByPci(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfaceByPci) - err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) +// UnmarshalBareMetalServerNetworkAttachmentByVlan unmarshals an instance of BareMetalServerNetworkAttachmentByVlan from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentByVlan(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentByVlan) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) if err != nil { return } - err = core.UnmarshalPrimitive(m, "mac_address", &obj.MacAddress) + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { return } - err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) if err != nil { return } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext) if err != nil { return } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) + err = core.UnmarshalPrimitive(m, "allow_to_float", &obj.AllowToFloat) if err != nil { return } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) if err != nil { return } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + err = core.UnmarshalPrimitive(m, "vlan", &obj.Vlan) if err != nil { return } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. +// Models which "extend" this model: +// - BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID +// - BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref +// - BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN +// This model "extends" BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface +type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id,omitempty"` + + // The URL for this virtual network interface. + Href *string `json:"href,omitempty"` + + // The CRN for this virtual network interface. + CRN *string `json:"crn,omitempty"` +} + +func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { + return true +} + +type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityIntf interface { + BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf + isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool +} + +func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +// UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } @@ -78894,129 +83589,81 @@ func UnmarshalBareMetalServerNetworkInterfaceByPci(m map[string]json.RawMessage, return } -// BareMetalServerNetworkInterfaceByVlan : BareMetalServerNetworkInterfaceByVlan struct -// This model "extends" BareMetalServerNetworkInterface -type BareMetalServerNetworkInterfaceByVlan struct { - // Indicates whether source IP spoofing is allowed on this bare metal server network interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"` +// BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext : The virtual network interface for this target. +// This model "extends" BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface +type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext 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"` - // The date and time that the bare metal server network interface was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + // Indicates whether this virtual network interface will be automatically deleted when + // `target` is deleted. + AutoDelete *bool `json:"auto_delete,omitempty"` // If `true`: // - The VPC infrastructure performs any needed NAT operations. // - `floating_ips` must not have more than one floating IP. // // If `false`: - // - Packets are passed unchanged to/from the bare metal server network interface, + // - Packets are passed unchanged to/from the virtual network interface, // allowing the workload to perform any needed NAT operations. // - `allow_ip_spoofing` must be `false`. - // - `interface_type` must not be `hipersocket`. - EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` - - // The floating IPs associated with this bare metal server network interface. - FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` - - // The URL for this bare metal server network interface. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this bare metal server network interface. - ID *string `json:"id" validate:"required"` - - // The MAC address of this bare metal server network interface. If the MAC address has not yet been selected, the value - // will be an empty string. - MacAddress *string `json:"mac_address" validate:"required"` - - // The name for this bare metal server network interface. - Name *string `json:"name" validate:"required"` - - // The bare metal server 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 bare metal server network interface. - SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` - - // The status of the bare metal server network interface. - Status *string `json:"status" validate:"required"` - - // The associated subnet. - Subnet *SubnetReference `json:"subnet" validate:"required"` - - // The bare metal server network interface type. - Type *string `json:"type" validate:"required"` + // - Can only be attached to a `target` with a `resource_type` of + // `bare_metal_server_network_attachment`. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` - // Indicates if the data path for the network interface can float to another bare metal server. Can only be `true` for - // network interfaces with an `interface_type` of `vlan`. + // Additional IP addresses to bind to the virtual network interface. Each item may be either a reserved IP identity, or + // a reserved IP prototype object which will be used to create a new reserved IP. All IP addresses must be in the + // primary IP's subnet. // - // If `true`, and the network detects traffic for this data path on another bare metal server in the resource group, - // the network interface will be automatically deleted from this bare metal server and a new network interface with the - // same `id`, `name` and `vlan` will be created on the other bare metal server. + // If reserved IP identities are provided, the specified reserved IPs must be unbound. // - // For the data path to float, the other bare metal server must be in the same - // `resource_group`, and must have a network interface with `interface_type` of `pci` with `allowed_vlans` including - // this network interface's `vlan`. - AllowInterfaceToFloat *bool `json:"allow_interface_to_float" validate:"required"` - - // - `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"` + // If reserved IP prototype objects with addresses are provided, the addresses must be available on the virtual network + // interface's subnet. For any prototype objects that do not specify an address, an available address on the subnet + // will be automatically selected and reserved. + Ips []VirtualNetworkInterfaceIPPrototypeIntf `json:"ips,omitempty"` - // The VLAN ID used in the IEEE 802.1Q tag present in all traffic on this interface. - Vlan *int64 `json:"vlan" validate:"required"` -} + // The name for this virtual network interface. The name must not be used by another virtual network interface in the + // VPC. If unspecified, the name will be a hyphenated list of randomly-selected words. Names beginning with `ibm-` are + // reserved for provider-owned resources, and are not allowed. + Name *string `json:"name,omitempty"` -// Constants associated with the BareMetalServerNetworkInterfaceByVlan.ResourceType property. -// The resource type. -const ( - BareMetalServerNetworkInterfaceByVlanResourceTypeNetworkInterfaceConst = "network_interface" -) + // The primary IP address to bind to the virtual network interface. May be either a + // reserved IP identity, or a reserved IP prototype object which will be used to create a + // new reserved IP. + // + // If a reserved IP identity is provided, the specified reserved IP must be unbound. + // + // If a reserved IP prototype object with an address is provided, the address must be + // available on the virtual network interface's subnet. If no address is specified, + // an available address on the subnet will be automatically selected and reserved. + PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"` -// Constants associated with the BareMetalServerNetworkInterfaceByVlan.Status property. -// The status of the bare metal server network interface. -const ( - BareMetalServerNetworkInterfaceByVlanStatusAvailableConst = "available" - BareMetalServerNetworkInterfaceByVlanStatusDeletingConst = "deleting" - BareMetalServerNetworkInterfaceByVlanStatusFailedConst = "failed" - BareMetalServerNetworkInterfaceByVlanStatusPendingConst = "pending" -) + // The resource group to use for this virtual network interface. If unspecified, the + // bare metal server's resource group will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` -// Constants associated with the BareMetalServerNetworkInterfaceByVlan.Type property. -// The bare metal server network interface type. -const ( - BareMetalServerNetworkInterfaceByVlanTypePrimaryConst = "primary" - BareMetalServerNetworkInterfaceByVlanTypeSecondaryConst = "secondary" -) + // The security groups to use for this virtual network interface. If unspecified, the default security group of the VPC + // for the subnet is used. + SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` -// Constants associated with the BareMetalServerNetworkInterfaceByVlan.InterfaceType property. -// - `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 ( - BareMetalServerNetworkInterfaceByVlanInterfaceTypeVlanConst = "vlan" -) + // The associated subnet. Required if `primary_ip` does not specify a reserved IP + // identity. + Subnet SubnetIdentityIntf `json:"subnet,omitempty"` +} -func (*BareMetalServerNetworkInterfaceByVlan) isaBareMetalServerNetworkInterface() bool { +func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool { return true } -// UnmarshalBareMetalServerNetworkInterfaceByVlan unmarshals an instance of BareMetalServerNetworkInterfaceByVlan from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfaceByVlan(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfaceByVlan) +// UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) if err != nil { return } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) if err != nil { return } @@ -79024,55 +83671,169 @@ func UnmarshalBareMetalServerNetworkInterfaceByVlan(m map[string]json.RawMessage if err != nil { return } - err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPPrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPPrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "mac_address", &obj.MacAddress) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) if err != nil { return } - err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) if err != nil { return } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype : BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype struct +// This model "extends" BareMetalServerNetworkAttachmentPrototype +type BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype struct { + // The name for this bare metal server network attachment. Names must be unique within the bare metal server the + // network attachment resides in. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + VirtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf `json:"virtual_network_interface" validate:"required"` + + // The VLAN IDs to allow for `vlan` attachments using this PCI attachment. + AllowedVlans []int64 `json:"allowed_vlans,omitempty"` + + // - `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 attachment + // - Cannot directly use an IEEE 802.1Q tag. + // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. + InterfaceType *string `json:"interface_type" validate:"required"` +} + +// Constants associated with the BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype.InterfaceType property. +// - `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 attachment +// - Cannot directly use an IEEE 802.1Q tag. +// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. +const ( + BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototypeInterfaceTypePciConst = "pci" +) + +// NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype : Instantiate BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype(virtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf, interfaceType string) (_model *BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype, err error) { + _model = &BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype{ + VirtualNetworkInterface: virtualNetworkInterface, + InterfaceType: core.StringPtr(interfaceType), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) isaBareMetalServerNetworkAttachmentPrototype() bool { + return true +} + +// UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) if err != nil { return } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) if err != nil { return } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) if err != nil { return } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype : BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype struct +// This model "extends" BareMetalServerNetworkAttachmentPrototype +type BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype struct { + // The name for this bare metal server network attachment. Names must be unique within the bare metal server the + // network attachment resides in. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + VirtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf `json:"virtual_network_interface" validate:"required"` + + // Indicates if the data path for the network attachment can float to another bare metal server. Can only be `true` for + // network attachments with an `interface_type` of `vlan`. + // + // If `true`, and the network detects traffic for this data path on another bare metal server in the resource group, + // the network attachment will be automatically deleted from this bare metal server and a new network attachment with + // the same `id`, `name` and `vlan` will be created on the other bare metal server. The virtual network interface for + // this network attachment will be automatically be attached to the new network attachment. + // + // For the data path to float, the other bare metal server must be in the same + // `resource_group`, and must have a network attachment with `interface_type` of `pci` with `allowed_vlans` including + // this network attachment's `vlan`. + AllowToFloat *bool `json:"allow_to_float,omitempty"` + + // - `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. + InterfaceType *string `json:"interface_type" validate:"required"` + + // The IEEE 802.1Q VLAN ID that must be used for all traffic on this attachment. + Vlan *int64 `json:"vlan" validate:"required"` +} + +// Constants associated with the BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype.InterfaceType property. +// - `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. +const ( + BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototypeInterfaceTypeVlanConst = "vlan" +) + +// NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype : Instantiate BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype(virtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf, interfaceType string, vlan int64) (_model *BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype, err error) { + _model = &BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype{ + VirtualNetworkInterface: virtualNetworkInterface, + InterfaceType: core.StringPtr(interfaceType), + Vlan: core.Int64Ptr(vlan), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype) isaBareMetalServerNetworkAttachmentPrototype() bool { + return true +} + +// UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) if err != nil { return } - err = core.UnmarshalPrimitive(m, "allow_interface_to_float", &obj.AllowInterfaceToFloat) + err = core.UnmarshalPrimitive(m, "allow_to_float", &obj.AllowToFloat) if err != nil { return } @@ -79088,11 +83849,23 @@ func UnmarshalBareMetalServerNetworkInterfaceByVlan(m map[string]json.RawMessage return } -// BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype : BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype struct -// This model "extends" BareMetalServerNetworkInterfacePrototype -type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype struct { +// BareMetalServerNetworkInterfaceByHiperSocket : BareMetalServerNetworkInterfaceByHiperSocket struct +// This model "extends" BareMetalServerNetworkInterface +type BareMetalServerNetworkInterfaceByHiperSocket struct { // Indicates whether source IP spoofing is allowed on this bare metal server network interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and source IP spoofing is managed on the attached virtual + // network interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"` + + // The date and time that the bare metal server network interface was created. + // + // If this bare metal server has network attachments, this network interface was created as a [read-only + // representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) when its corresponding network attachment + // was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` // If `true`: // - The VPC infrastructure performs any needed NAT operations. @@ -79103,79 +83876,196 @@ type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHi // allowing the workload to perform any needed NAT operations. // - `allow_ip_spoofing` must be `false`. // - `interface_type` must not be `hipersocket`. - EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and infrastructure NAT is managed on the attached virtual + // network interface. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` - // The name for this bare metal server network interface. The name must not be used by another network interface on the - // bare metal server. If unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` + // The floating IPs associated with this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the floating IPs are associated with the attached virtual + // network interface. + FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` - // The primary IP address to bind to the bare metal server network interface. This can be specified using an existing - // reserved IP, or a prototype object for a new reserved IP. + // The URL for this bare metal server network interface. // - // If an existing reserved IP or a prototype object with an address is specified, it must be available on the bare - // metal server network interface's subnet. Otherwise, an available address on the subnet will be automatically - // selected and reserved. - PrimaryIP NetworkInterfaceIPPrototypeIntf `json:"primary_ip,omitempty"` + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. + Href *string `json:"href" validate:"required"` - // The security groups to use for this bare metal server network interface. If unspecified, the VPC's default security - // group is used. - SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` + // The unique identifier for this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the identifier is that of the corresponding network + // attachment. + ID *string `json:"id" validate:"required"` + + // The MAC address of this bare metal server network interface. If the MAC address has not yet been selected, the value + // will be an empty string. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the MAC address is that of the attached virtual network + // interface. + MacAddress *string `json:"mac_address" validate:"required"` + + // The name for this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the name matches its corresponding network attachment. + Name *string `json:"name" validate:"required"` + + // The bare metal server network interface port speed in Mbps. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the port speed is that of its corresponding network + // attachment. + 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 bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the security groups are associated with the attached + // virtual network interface. + SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` + + // The status of the bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a read-only representation of its + // corresponding network attachment and its attached virtual network interface, and the status is [computed from + // them](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients). + Status *string `json:"status" validate:"required"` // The associated subnet. - Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` + Subnet *SubnetReference `json:"subnet" validate:"required"` + + // The bare metal server network interface type. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the type is that of its corresponding network attachment. + Type *string `json:"type" validate:"required"` // - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity // within a `s390x` based system. - // - Not supported on bare metal servers with a `cpu.architecture` of `amd64`. InterfaceType *string `json:"interface_type" validate:"required"` } -// Constants associated with the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype.InterfaceType property. +// Constants associated with the BareMetalServerNetworkInterfaceByHiperSocket.ResourceType property. +// The resource type. +const ( + BareMetalServerNetworkInterfaceByHiperSocketResourceTypeNetworkInterfaceConst = "network_interface" +) + +// Constants associated with the BareMetalServerNetworkInterfaceByHiperSocket.Status property. +// The status of the bare metal server network interface. +// +// If this bare metal server has network attachments, this network interface is a read-only representation of its +// corresponding network attachment and its attached virtual network interface, and the status is [computed from +// them](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients). +const ( + BareMetalServerNetworkInterfaceByHiperSocketStatusAvailableConst = "available" + BareMetalServerNetworkInterfaceByHiperSocketStatusDeletingConst = "deleting" + BareMetalServerNetworkInterfaceByHiperSocketStatusFailedConst = "failed" + BareMetalServerNetworkInterfaceByHiperSocketStatusPendingConst = "pending" +) + +// Constants associated with the BareMetalServerNetworkInterfaceByHiperSocket.Type property. +// The bare metal server network interface type. +// +// If this bare metal server has network attachments, this network interface is a +// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network +// attachment and its attached virtual network interface, and the type is that of its corresponding network attachment. +const ( + BareMetalServerNetworkInterfaceByHiperSocketTypePrimaryConst = "primary" + BareMetalServerNetworkInterfaceByHiperSocketTypeSecondaryConst = "secondary" +) + +// Constants associated with the BareMetalServerNetworkInterfaceByHiperSocket.InterfaceType property. // - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity // within a `s390x` based system. -// - Not supported on bare metal servers with a `cpu.architecture` of `amd64`. const ( - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototypeInterfaceTypeHipersocketConst = "hipersocket" + BareMetalServerNetworkInterfaceByHiperSocketInterfaceTypeHipersocketConst = "hipersocket" ) -// NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype : Instantiate BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype(subnet SubnetIdentityIntf, interfaceType string) (_model *BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype, err error) { - _model = &BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype{ - Subnet: subnet, - InterfaceType: core.StringPtr(interfaceType), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) isaBareMetalServerNetworkInterfacePrototype() bool { +func (*BareMetalServerNetworkInterfaceByHiperSocket) isaBareMetalServerNetworkInterface() bool { return true } -// UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype unmarshals an instance of BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) +// UnmarshalBareMetalServerNetworkInterfaceByHiperSocket unmarshals an instance of BareMetalServerNetworkInterfaceByHiperSocket from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfaceByHiperSocket(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfaceByHiperSocket) err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) if err != nil { return } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) if err != nil { return } + err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) + 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, "mac_address", &obj.MacAddress) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalNetworkInterfaceIPPrototype) + err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) if err != nil { return } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) if err != nil { return } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) + 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, "type", &obj.Type) if err != nil { return } @@ -79187,11 +84077,23 @@ func UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInte return } -// BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype : BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype struct -// This model "extends" BareMetalServerNetworkInterfacePrototype -type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype struct { +// BareMetalServerNetworkInterfaceByPci : BareMetalServerNetworkInterfaceByPci struct +// This model "extends" BareMetalServerNetworkInterface +type BareMetalServerNetworkInterfaceByPci struct { // Indicates whether source IP spoofing is allowed on this bare metal server network interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and source IP spoofing is managed on the attached virtual + // network interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"` + + // The date and time that the bare metal server network interface was created. + // + // If this bare metal server has network attachments, this network interface was created as a [read-only + // representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) when its corresponding network attachment + // was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` // If `true`: // - The VPC infrastructure performs any needed NAT operations. @@ -79202,88 +84104,210 @@ type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPc // allowing the workload to perform any needed NAT operations. // - `allow_ip_spoofing` must be `false`. // - `interface_type` must not be `hipersocket`. - EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and infrastructure NAT is managed on the attached virtual + // network interface. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` - // The name for this bare metal server network interface. The name must not be used by another network interface on the - // bare metal server. If unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` + // The floating IPs associated with this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the floating IPs are associated with the attached virtual + // network interface. + FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` - // The primary IP address to bind to the bare metal server network interface. This can be specified using an existing - // reserved IP, or a prototype object for a new reserved IP. + // The URL for this bare metal server network interface. // - // If an existing reserved IP or a prototype object with an address is specified, it must be available on the bare - // metal server network interface's subnet. Otherwise, an available address on the subnet will be automatically - // selected and reserved. - PrimaryIP NetworkInterfaceIPPrototypeIntf `json:"primary_ip,omitempty"` + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. + Href *string `json:"href" validate:"required"` - // The security groups to use for this bare metal server network interface. If unspecified, the VPC's default security - // group is used. - SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` + // The unique identifier for this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the identifier is that of the corresponding network + // attachment. + ID *string `json:"id" validate:"required"` + + // The MAC address of this bare metal server network interface. If the MAC address has not yet been selected, the value + // will be an empty string. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the MAC address is that of the attached virtual network + // interface. + MacAddress *string `json:"mac_address" validate:"required"` + + // The name for this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the name matches its corresponding network attachment. + Name *string `json:"name" validate:"required"` + + // The bare metal server network interface port speed in Mbps. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the port speed is that of its corresponding network + // attachment. + 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 bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the security groups are associated with the attached + // virtual network interface. + SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` + + // The status of the bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a read-only representation of its + // corresponding network attachment and its attached virtual network interface, and the status is [computed from + // them](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients). + Status *string `json:"status" validate:"required"` // The associated subnet. - Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` + Subnet *SubnetReference `json:"subnet" validate:"required"` - // The VLAN IDs to allow for `vlan` interfaces using this PCI interface. - AllowedVlans []int64 `json:"allowed_vlans,omitempty"` + // The bare metal server network interface type. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the type is that of its corresponding network attachment. + Type *string `json:"type" validate:"required"` + + // The VLAN IDs allowed for `vlan` interfaces using this PCI interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the VLAN IDs match the `allow_vlans` of the corresponding + // network attachment. + AllowedVlans []int64 `json:"allowed_vlans" validate:"required"` // - `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 tag. - // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. InterfaceType *string `json:"interface_type" validate:"required"` } -// Constants associated with the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype.InterfaceType property. +// Constants associated with the BareMetalServerNetworkInterfaceByPci.ResourceType property. +// The resource type. +const ( + BareMetalServerNetworkInterfaceByPciResourceTypeNetworkInterfaceConst = "network_interface" +) + +// Constants associated with the BareMetalServerNetworkInterfaceByPci.Status property. +// The status of the bare metal server network interface. +// +// If this bare metal server has network attachments, this network interface is a read-only representation of its +// corresponding network attachment and its attached virtual network interface, and the status is [computed from +// them](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients). +const ( + BareMetalServerNetworkInterfaceByPciStatusAvailableConst = "available" + BareMetalServerNetworkInterfaceByPciStatusDeletingConst = "deleting" + BareMetalServerNetworkInterfaceByPciStatusFailedConst = "failed" + BareMetalServerNetworkInterfaceByPciStatusPendingConst = "pending" +) + +// Constants associated with the BareMetalServerNetworkInterfaceByPci.Type property. +// The bare metal server network interface type. +// +// If this bare metal server has network attachments, this network interface is a +// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network +// attachment and its attached virtual network interface, and the type is that of its corresponding network attachment. +const ( + BareMetalServerNetworkInterfaceByPciTypePrimaryConst = "primary" + BareMetalServerNetworkInterfaceByPciTypeSecondaryConst = "secondary" +) + +// Constants associated with the BareMetalServerNetworkInterfaceByPci.InterfaceType property. // - `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 tag. -// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. const ( - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototypeInterfaceTypePciConst = "pci" + BareMetalServerNetworkInterfaceByPciInterfaceTypePciConst = "pci" ) -// NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype : Instantiate BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype(subnet SubnetIdentityIntf, interfaceType string) (_model *BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype, err error) { - _model = &BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype{ - Subnet: subnet, - InterfaceType: core.StringPtr(interfaceType), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) isaBareMetalServerNetworkInterfacePrototype() bool { +func (*BareMetalServerNetworkInterfaceByPci) isaBareMetalServerNetworkInterface() bool { return true } -// UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype unmarshals an instance of BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) +// UnmarshalBareMetalServerNetworkInterfaceByPci unmarshals an instance of BareMetalServerNetworkInterfaceByPci from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfaceByPci(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfaceByPci) err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) if err != nil { return } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) if err != nil { return } + err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) + 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, "mac_address", &obj.MacAddress) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalNetworkInterfaceIPPrototype) + err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) if err != nil { return } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) if err != nil { return } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) + 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, "type", &obj.Type) if err != nil { return } @@ -79299,11 +84323,23 @@ func UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInte return } -// BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype : BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype struct -// This model "extends" BareMetalServerNetworkInterfacePrototype -type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype struct { +// BareMetalServerNetworkInterfaceByVlan : BareMetalServerNetworkInterfaceByVlan struct +// This model "extends" BareMetalServerNetworkInterface +type BareMetalServerNetworkInterfaceByVlan struct { // Indicates whether source IP spoofing is allowed on this bare metal server network interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and source IP spoofing is managed on the attached virtual + // network interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"` + + // The date and time that the bare metal server network interface was created. + // + // If this bare metal server has network attachments, this network interface was created as a [read-only + // representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) when its corresponding network attachment + // was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` // If `true`: // - The VPC infrastructure performs any needed NAT operations. @@ -79314,26 +84350,89 @@ type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVl // allowing the workload to perform any needed NAT operations. // - `allow_ip_spoofing` must be `false`. // - `interface_type` must not be `hipersocket`. - EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and infrastructure NAT is managed on the attached virtual + // network interface. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` - // The name for this bare metal server network interface. The name must not be used by another network interface on the - // bare metal server. If unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` + // The floating IPs associated with this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the floating IPs are associated with the attached virtual + // network interface. + FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` - // The primary IP address to bind to the bare metal server network interface. This can be specified using an existing - // reserved IP, or a prototype object for a new reserved IP. + // The URL for this bare metal server network interface. // - // If an existing reserved IP or a prototype object with an address is specified, it must be available on the bare - // metal server network interface's subnet. Otherwise, an available address on the subnet will be automatically - // selected and reserved. - PrimaryIP NetworkInterfaceIPPrototypeIntf `json:"primary_ip,omitempty"` + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. + Href *string `json:"href" validate:"required"` - // The security groups to use for this bare metal server network interface. If unspecified, the VPC's default security - // group is used. - SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` + // The unique identifier for this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the identifier is that of the corresponding network + // attachment. + ID *string `json:"id" validate:"required"` + + // The MAC address of this bare metal server network interface. If the MAC address has not yet been selected, the value + // will be an empty string. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the MAC address is that of the attached virtual network + // interface. + MacAddress *string `json:"mac_address" validate:"required"` + + // The name for this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the name matches its corresponding network attachment. + Name *string `json:"name" validate:"required"` + + // The bare metal server network interface port speed in Mbps. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the port speed is that of its corresponding network + // attachment. + 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 bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the security groups are associated with the attached + // virtual network interface. + SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` + + // The status of the bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a read-only representation of its + // corresponding network attachment and its attached virtual network interface, and the status is [computed from + // them](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients). + Status *string `json:"status" validate:"required"` // The associated subnet. - Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` + Subnet *SubnetReference `json:"subnet" validate:"required"` + + // The bare metal server network interface type. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the type is that of its corresponding network attachment. + Type *string `json:"type" validate:"required"` // Indicates if the data path for the network interface can float to another bare metal server. Can only be `true` for // network interfaces with an `interface_type` of `vlan`. @@ -79345,38 +84444,481 @@ type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVl // For the data path to float, the other bare metal server must be in the same // `resource_group`, and must have a network interface with `interface_type` of `pci` with `allowed_vlans` including // this network interface's `vlan`. - AllowInterfaceToFloat *bool `json:"allow_interface_to_float,omitempty"` + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the value of this property matches that of the + // `allow_to_float` property of the corresponding network attachment. + AllowInterfaceToFloat *bool `json:"allow_interface_to_float" validate:"required"` // - `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. - // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. InterfaceType *string `json:"interface_type" validate:"required"` // The VLAN ID used in the IEEE 802.1Q tag present in all traffic on this interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the VLAN ID matches the `vlan` of the corresponding + // network attachment. Vlan *int64 `json:"vlan" validate:"required"` } -// Constants associated with the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype.InterfaceType property. +// Constants associated with the BareMetalServerNetworkInterfaceByVlan.ResourceType property. +// The resource type. +const ( + BareMetalServerNetworkInterfaceByVlanResourceTypeNetworkInterfaceConst = "network_interface" +) + +// Constants associated with the BareMetalServerNetworkInterfaceByVlan.Status property. +// The status of the bare metal server network interface. +// +// If this bare metal server has network attachments, this network interface is a read-only representation of its +// corresponding network attachment and its attached virtual network interface, and the status is [computed from +// them](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients). +const ( + BareMetalServerNetworkInterfaceByVlanStatusAvailableConst = "available" + BareMetalServerNetworkInterfaceByVlanStatusDeletingConst = "deleting" + BareMetalServerNetworkInterfaceByVlanStatusFailedConst = "failed" + BareMetalServerNetworkInterfaceByVlanStatusPendingConst = "pending" +) + +// Constants associated with the BareMetalServerNetworkInterfaceByVlan.Type property. +// The bare metal server network interface type. +// +// If this bare metal server has network attachments, this network interface is a +// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network +// attachment and its attached virtual network interface, and the type is that of its corresponding network attachment. +const ( + BareMetalServerNetworkInterfaceByVlanTypePrimaryConst = "primary" + BareMetalServerNetworkInterfaceByVlanTypeSecondaryConst = "secondary" +) + +// Constants associated with the BareMetalServerNetworkInterfaceByVlan.InterfaceType property. // - `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. -// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. const ( - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototypeInterfaceTypeVlanConst = "vlan" + BareMetalServerNetworkInterfaceByVlanInterfaceTypeVlanConst = "vlan" ) -// NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype : Instantiate BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype(subnet SubnetIdentityIntf, interfaceType string, vlan int64) (_model *BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype, err error) { - _model = &BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype{ - Subnet: subnet, - InterfaceType: core.StringPtr(interfaceType), - Vlan: core.Int64Ptr(vlan), - } +func (*BareMetalServerNetworkInterfaceByVlan) isaBareMetalServerNetworkInterface() bool { + return true +} + +// UnmarshalBareMetalServerNetworkInterfaceByVlan unmarshals an instance of BareMetalServerNetworkInterfaceByVlan from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfaceByVlan(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfaceByVlan) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) + 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, "mac_address", &obj.MacAddress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) + 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, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allow_interface_to_float", &obj.AllowInterfaceToFloat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "vlan", &obj.Vlan) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype : BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype struct +// This model "extends" BareMetalServerNetworkInterfacePrototype +type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype struct { + // Indicates whether source IP spoofing is allowed on this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and source IP spoofing is managed on the attached virtual + // network interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` + + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - `floating_ips` must not have more than one floating IP. + // + // If `false`: + // - Packets are passed unchanged to/from the bare metal server network interface, + // allowing the workload to perform any needed NAT operations. + // - `allow_ip_spoofing` must be `false`. + // - `interface_type` must not be `hipersocket`. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and infrastructure NAT is managed on the attached virtual + // network interface. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` + + // The name for this bare metal server network interface. The name must not be used by another network interface on the + // bare metal server. 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 bare metal server 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 bare + // metal server 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 bare metal server 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"` + + // - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity + // within a `s390x` based system. + // - Not supported on bare metal servers with a `cpu.architecture` of `amd64`. + InterfaceType *string `json:"interface_type" validate:"required"` +} + +// Constants associated with the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype.InterfaceType property. +// - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity +// within a `s390x` based system. +// - Not supported on bare metal servers with a `cpu.architecture` of `amd64`. +const ( + BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototypeInterfaceTypeHipersocketConst = "hipersocket" +) + +// NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype : Instantiate BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype(subnet SubnetIdentityIntf, interfaceType string) (_model *BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype, err error) { + _model = &BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype{ + Subnet: subnet, + InterfaceType: core.StringPtr(interfaceType), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) isaBareMetalServerNetworkInterfacePrototype() bool { + return true +} + +// UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype unmarshals an instance of BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + 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 + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalNetworkInterfaceIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype : BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype struct +// This model "extends" BareMetalServerNetworkInterfacePrototype +type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype struct { + // Indicates whether source IP spoofing is allowed on this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and source IP spoofing is managed on the attached virtual + // network interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` + + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - `floating_ips` must not have more than one floating IP. + // + // If `false`: + // - Packets are passed unchanged to/from the bare metal server network interface, + // allowing the workload to perform any needed NAT operations. + // - `allow_ip_spoofing` must be `false`. + // - `interface_type` must not be `hipersocket`. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and infrastructure NAT is managed on the attached virtual + // network interface. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` + + // The name for this bare metal server network interface. The name must not be used by another network interface on the + // bare metal server. 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 bare metal server 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 bare + // metal server 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 bare metal server 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"` + + // The VLAN IDs to allow for `vlan` interfaces using this PCI interface. + AllowedVlans []int64 `json:"allowed_vlans,omitempty"` + + // - `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 tag. + // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. + InterfaceType *string `json:"interface_type" validate:"required"` +} + +// Constants associated with the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype.InterfaceType property. +// - `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 tag. +// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. +const ( + BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototypeInterfaceTypePciConst = "pci" +) + +// NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype : Instantiate BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype(subnet SubnetIdentityIntf, interfaceType string) (_model *BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype, err error) { + _model = &BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype{ + Subnet: subnet, + InterfaceType: core.StringPtr(interfaceType), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) isaBareMetalServerNetworkInterfacePrototype() bool { + return true +} + +// UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype unmarshals an instance of BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + 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 + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalNetworkInterfaceIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype : BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype struct +// This model "extends" BareMetalServerNetworkInterfacePrototype +type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype struct { + // Indicates whether source IP spoofing is allowed on this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and source IP spoofing is managed on the attached virtual + // network interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` + + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - `floating_ips` must not have more than one floating IP. + // + // If `false`: + // - Packets are passed unchanged to/from the bare metal server network interface, + // allowing the workload to perform any needed NAT operations. + // - `allow_ip_spoofing` must be `false`. + // - `interface_type` must not be `hipersocket`. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and infrastructure NAT is managed on the attached virtual + // network interface. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` + + // The name for this bare metal server network interface. The name must not be used by another network interface on the + // bare metal server. 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 bare metal server 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 bare + // metal server 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 bare metal server 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 if the data path for the network interface can float to another bare metal server. Can only be `true` for + // network interfaces with an `interface_type` of `vlan`. + // + // If `true`, and the network detects traffic for this data path on another bare metal server in the resource group, + // the network interface will be automatically deleted from this bare metal server and a new network interface with the + // same `id`, `name` and `vlan` will be created on the other bare metal server. + // + // For the data path to float, the other bare metal server must be in the same + // `resource_group`, and must have a network interface with `interface_type` of `pci` with `allowed_vlans` including + // this network interface's `vlan`. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the value of this property matches that of the + // `allow_to_float` property of the corresponding network attachment. + AllowInterfaceToFloat *bool `json:"allow_interface_to_float,omitempty"` + + // - `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. + // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. + InterfaceType *string `json:"interface_type" validate:"required"` + + // The VLAN ID used in the IEEE 802.1Q tag present in all traffic on this interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the VLAN ID matches the `vlan` of the corresponding + // network attachment. + Vlan *int64 `json:"vlan" validate:"required"` +} + +// Constants associated with the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype.InterfaceType property. +// - `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. +// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. +const ( + BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototypeInterfaceTypeVlanConst = "vlan" +) + +// NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype : Instantiate BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype(subnet SubnetIdentityIntf, interfaceType string, vlan int64) (_model *BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype, err error) { + _model = &BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype{ + Subnet: subnet, + InterfaceType: core.StringPtr(interfaceType), + Vlan: core.Int64Ptr(vlan), + } err = core.ValidateStruct(_model, "required parameters") return } @@ -79428,8 +84970,76 @@ func UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInte return } -// BareMetalServerProfileBandwidthDependent : The total bandwidth shared across the bare metal server network interfaces of a bare metal server with this profile -// depends on its configuration. +// BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype : BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype struct +// This model "extends" BareMetalServerPrimaryNetworkAttachmentPrototype +type BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype struct { + // The name for this bare metal server network attachment. Names must be unique within the bare metal server the + // network attachment resides in. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + VirtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf `json:"virtual_network_interface" validate:"required"` + + // The VLAN IDs to allow for `vlan` attachments using this PCI attachment. + AllowedVlans []int64 `json:"allowed_vlans,omitempty"` + + // - `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 attachment + // - Cannot directly use an IEEE 802.1Q tag. + // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. + InterfaceType *string `json:"interface_type,omitempty"` +} + +// Constants associated with the BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype.InterfaceType property. +// - `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 attachment +// - Cannot directly use an IEEE 802.1Q tag. +// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. +const ( + BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototypeInterfaceTypePciConst = "pci" +) + +// NewBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype : Instantiate BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype(virtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf) (_model *BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype, err error) { + _model = &BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype{ + VirtualNetworkInterface: virtualNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype) isaBareMetalServerPrimaryNetworkAttachmentPrototype() bool { + return true +} + +// UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype unmarshals an instance of BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype from the specified map of raw messages. +func UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileBandwidthDependent : The total bandwidth shared across the bare metal server network attachments or bare metal server network interfaces +// of a bare metal server with this profile depends on its configuration. // This model "extends" BareMetalServerProfileBandwidth type BareMetalServerProfileBandwidthDependent struct { // The type for this profile field. @@ -79457,8 +85067,8 @@ func UnmarshalBareMetalServerProfileBandwidthDependent(m map[string]json.RawMess return } -// BareMetalServerProfileBandwidthEnum : The permitted total bandwidth values (in megabits per second) shared across the bare metal server network interfaces -// of a bare metal server with this profile. +// BareMetalServerProfileBandwidthEnum : The permitted total bandwidth values (in megabits per second) shared across the bare metal server network attachments +// or bare metal server network interfaces of a bare metal server with this profile. // This model "extends" BareMetalServerProfileBandwidth type BareMetalServerProfileBandwidthEnum struct { // The default value for this profile field. @@ -79500,8 +85110,8 @@ func UnmarshalBareMetalServerProfileBandwidthEnum(m map[string]json.RawMessage, return } -// BareMetalServerProfileBandwidthFixed : The total bandwidth (in megabits per second) shared across the bare metal server network interfaces of a bare metal -// server with this profile. +// BareMetalServerProfileBandwidthFixed : The total bandwidth (in megabits per second) shared across the bare metal server network attachments or bare metal +// server network interfaces of a bare metal server with this profile. // This model "extends" BareMetalServerProfileBandwidth type BareMetalServerProfileBandwidthFixed struct { // The type for this profile field. @@ -79536,8 +85146,8 @@ func UnmarshalBareMetalServerProfileBandwidthFixed(m map[string]json.RawMessage, return } -// BareMetalServerProfileBandwidthRange : The permitted total bandwidth range (in megabits per second) shared across the bare metal server network interfaces -// of a bare metal server with this profile. +// BareMetalServerProfileBandwidthRange : The permitted total bandwidth range (in megabits per second) shared across the network attachments or network +// interfaces of a bare metal server with this profile. // This model "extends" BareMetalServerProfileBandwidth type BareMetalServerProfileBandwidthRange struct { // The default value for this profile field. @@ -80463,6 +86073,77 @@ func UnmarshalBareMetalServerProfileMemoryRange(m map[string]json.RawMessage, re return } +// BareMetalServerProfileNetworkAttachmentCountDependent : The number of network attachments supported on a bare metal server with this profile is dependent on its +// configuration. +// This model "extends" BareMetalServerProfileNetworkAttachmentCount +type BareMetalServerProfileNetworkAttachmentCountDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileNetworkAttachmentCountDependent.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileNetworkAttachmentCountDependentTypeDependentConst = "dependent" +) + +func (*BareMetalServerProfileNetworkAttachmentCountDependent) isaBareMetalServerProfileNetworkAttachmentCount() bool { + return true +} + +// UnmarshalBareMetalServerProfileNetworkAttachmentCountDependent unmarshals an instance of BareMetalServerProfileNetworkAttachmentCountDependent from the specified map of raw messages. +func UnmarshalBareMetalServerProfileNetworkAttachmentCountDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileNetworkAttachmentCountDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileNetworkAttachmentCountRange : The number of network attachments supported on a bare metal server with this profile. +// This model "extends" BareMetalServerProfileNetworkAttachmentCount +type BareMetalServerProfileNetworkAttachmentCountRange struct { + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileNetworkAttachmentCountRange.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileNetworkAttachmentCountRangeTypeRangeConst = "range" +) + +func (*BareMetalServerProfileNetworkAttachmentCountRange) isaBareMetalServerProfileNetworkAttachmentCount() bool { + return true +} + +// UnmarshalBareMetalServerProfileNetworkAttachmentCountRange unmarshals an instance of BareMetalServerProfileNetworkAttachmentCountRange from the specified map of raw messages. +func UnmarshalBareMetalServerProfileNetworkAttachmentCountRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileNetworkAttachmentCountRange) + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // BareMetalServerProfileNetworkInterfaceCountDependent : The number of bare metal server network interfaces supported on a bare metal server with this profile is dependent on // its configuration. // This model "extends" BareMetalServerProfileNetworkInterfaceCount @@ -80534,6 +86215,210 @@ func UnmarshalBareMetalServerProfileNetworkInterfaceCountRange(m map[string]json return } +// BareMetalServerPrototypeBareMetalServerByNetworkAttachment : BareMetalServerPrototypeBareMetalServerByNetworkAttachment struct +// This model "extends" BareMetalServerPrototype +type BareMetalServerPrototypeBareMetalServerByNetworkAttachment struct { + // 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,omitempty"` + + Initialization *BareMetalServerInitializationPrototype `json:"initialization" validate:"required"` + + // The name for this bare metal server. The name must not be used by another bare metal server in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + // + // The system hostname will be based on this name. + Name *string `json:"name,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) to use for this bare metal + // server. + Profile BareMetalServerProfileIdentityIntf `json:"profile" validate:"required"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + TrustedPlatformModule *BareMetalServerTrustedPlatformModulePrototype `json:"trusted_platform_module,omitempty"` + + // The VPC this bare metal server will reside in. + // + // If specified, it must match the VPC for the subnets that the network attachments or network interfaces of the bare + // metal server are attached to. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The zone this bare metal server will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the bare metal server. + NetworkAttachments []BareMetalServerNetworkAttachmentPrototypeIntf `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the bare metal server. + PrimaryNetworkAttachment BareMetalServerPrimaryNetworkAttachmentPrototypeIntf `json:"primary_network_attachment" validate:"required"` +} + +// NewBareMetalServerPrototypeBareMetalServerByNetworkAttachment : Instantiate BareMetalServerPrototypeBareMetalServerByNetworkAttachment (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerPrototypeBareMetalServerByNetworkAttachment(initialization *BareMetalServerInitializationPrototype, profile BareMetalServerProfileIdentityIntf, zone ZoneIdentityIntf, primaryNetworkAttachment BareMetalServerPrimaryNetworkAttachmentPrototypeIntf) (_model *BareMetalServerPrototypeBareMetalServerByNetworkAttachment, err error) { + _model = &BareMetalServerPrototypeBareMetalServerByNetworkAttachment{ + Initialization: initialization, + Profile: profile, + Zone: zone, + PrimaryNetworkAttachment: primaryNetworkAttachment, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerPrototypeBareMetalServerByNetworkAttachment) isaBareMetalServerPrototype() bool { + return true +} + +// UnmarshalBareMetalServerPrototypeBareMetalServerByNetworkAttachment unmarshals an instance of BareMetalServerPrototypeBareMetalServerByNetworkAttachment from the specified map of raw messages. +func UnmarshalBareMetalServerPrototypeBareMetalServerByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerPrototypeBareMetalServerByNetworkAttachment) + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + return + } + err = core.UnmarshalModel(m, "initialization", &obj.Initialization, UnmarshalBareMetalServerInitializationPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalBareMetalServerProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalBareMetalServerNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerPrototypeBareMetalServerByNetworkInterface : BareMetalServerPrototypeBareMetalServerByNetworkInterface struct +// This model "extends" BareMetalServerPrototype +type BareMetalServerPrototypeBareMetalServerByNetworkInterface struct { + // 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,omitempty"` + + Initialization *BareMetalServerInitializationPrototype `json:"initialization" validate:"required"` + + // The name for this bare metal server. The name must not be used by another bare metal server in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + // + // The system hostname will be based on this name. + Name *string `json:"name,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) to use for this bare metal + // server. + Profile BareMetalServerProfileIdentityIntf `json:"profile" validate:"required"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + TrustedPlatformModule *BareMetalServerTrustedPlatformModulePrototype `json:"trusted_platform_module,omitempty"` + + // The VPC this bare metal server will reside in. + // + // If specified, it must match the VPC for the subnets that the network attachments or network interfaces of the bare + // metal server are attached to. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The zone this bare metal server will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional bare metal server network interfaces to create. + NetworkInterfaces []BareMetalServerNetworkInterfacePrototypeIntf `json:"network_interfaces,omitempty"` + + // The primary bare metal server network interface to create. + PrimaryNetworkInterface *BareMetalServerPrimaryNetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` +} + +// NewBareMetalServerPrototypeBareMetalServerByNetworkInterface : Instantiate BareMetalServerPrototypeBareMetalServerByNetworkInterface (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerPrototypeBareMetalServerByNetworkInterface(initialization *BareMetalServerInitializationPrototype, profile BareMetalServerProfileIdentityIntf, zone ZoneIdentityIntf, primaryNetworkInterface *BareMetalServerPrimaryNetworkInterfacePrototype) (_model *BareMetalServerPrototypeBareMetalServerByNetworkInterface, err error) { + _model = &BareMetalServerPrototypeBareMetalServerByNetworkInterface{ + Initialization: initialization, + Profile: profile, + Zone: zone, + PrimaryNetworkInterface: primaryNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerPrototypeBareMetalServerByNetworkInterface) isaBareMetalServerPrototype() bool { + return true +} + +// UnmarshalBareMetalServerPrototypeBareMetalServerByNetworkInterface unmarshals an instance of BareMetalServerPrototypeBareMetalServerByNetworkInterface from the specified map of raw messages. +func UnmarshalBareMetalServerPrototypeBareMetalServerByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerPrototypeBareMetalServerByNetworkInterface) + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + return + } + err = core.UnmarshalModel(m, "initialization", &obj.Initialization, UnmarshalBareMetalServerInitializationPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalBareMetalServerProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalBareMetalServerNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // CatalogOfferingIdentityCatalogOfferingByCRN : CatalogOfferingIdentityCatalogOfferingByCRN struct // This model "extends" CatalogOfferingIdentity type CatalogOfferingIdentityCatalogOfferingByCRN struct { @@ -81828,7 +87713,8 @@ type FloatingIPPrototypeFloatingIPByTarget struct { // resource is: // // - an instance network interface - // - a bare metal server network interface with `enable_infrastructure_nat` set to `true`. + // - a bare metal server network interface with `enable_infrastructure_nat` set to `true` + // - a virtual network interface with `enable_infrastructure_nat` set to `true`. Target FloatingIPTargetPrototypeIntf `json:"target" validate:"required"` } @@ -81916,9 +87802,18 @@ func UnmarshalFloatingIPPrototypeFloatingIPByZone(m map[string]json.RawMessage, // This model "extends" FloatingIPTargetPatch type FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity struct { // The unique identifier for this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the identifier is that of the corresponding network + // attachment. ID *string `json:"id,omitempty"` // The URL for this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href,omitempty"` } @@ -81957,9 +87852,18 @@ func UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity(m map // This model "extends" FloatingIPTargetPatch type FloatingIPTargetPatchNetworkInterfaceIdentity struct { // The unique identifier for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the identifier is that of the corresponding network + // attachment. ID *string `json:"id,omitempty"` // The URL for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href,omitempty"` } @@ -81991,6 +87895,55 @@ func UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentity(m map[string]json.Ra return } +// FloatingIPTargetPatchVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. +// Models which "extend" this model: +// - FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID +// - FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref +// - FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN +// This model "extends" FloatingIPTargetPatch +type FloatingIPTargetPatchVirtualNetworkInterfaceIdentity struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id,omitempty"` + + // The URL for this virtual network interface. + Href *string `json:"href,omitempty"` + + // The CRN for this virtual network interface. + CRN *string `json:"crn,omitempty"` +} + +func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentity) isaFloatingIPTargetPatchVirtualNetworkInterfaceIdentity() bool { + return true +} + +type FloatingIPTargetPatchVirtualNetworkInterfaceIdentityIntf interface { + FloatingIPTargetPatchIntf + isaFloatingIPTargetPatchVirtualNetworkInterfaceIdentity() bool +} + +func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentity) isaFloatingIPTargetPatch() bool { + return true +} + +// UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentity unmarshals an instance of FloatingIPTargetPatchVirtualNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPatchVirtualNetworkInterfaceIdentity) + 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, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity : Identifies a bare metal server network interface by a unique property. // Models which "extend" this model: // - FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID @@ -81998,9 +87951,18 @@ func UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentity(m map[string]json.Ra // This model "extends" FloatingIPTargetPrototype type FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity struct { // The unique identifier for this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the identifier is that of the corresponding network + // attachment. ID *string `json:"id,omitempty"` // The URL for this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href,omitempty"` } @@ -82039,9 +88001,18 @@ func UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity(m // This model "extends" FloatingIPTargetPrototype type FloatingIPTargetPrototypeNetworkInterfaceIdentity struct { // The unique identifier for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the identifier is that of the corresponding network + // attachment. ID *string `json:"id,omitempty"` // The URL for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href,omitempty"` } @@ -82073,6 +88044,55 @@ func UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentity(m map[string]jso return } +// FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. +// Models which "extend" this model: +// - FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID +// - FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref +// - FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN +// This model "extends" FloatingIPTargetPrototype +type FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id,omitempty"` + + // The URL for this virtual network interface. + Href *string `json:"href,omitempty"` + + // The CRN for this virtual network interface. + CRN *string `json:"crn,omitempty"` +} + +func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity) isaFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +type FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityIntf interface { + FloatingIPTargetPrototypeIntf + isaFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool +} + +func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity) isaFloatingIPTargetPrototype() bool { + return true +} + +// UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity unmarshals an instance of FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity) + 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, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // FloatingIPTargetBareMetalServerNetworkInterfaceReference : FloatingIPTargetBareMetalServerNetworkInterfaceReference struct // This model "extends" FloatingIPTarget type FloatingIPTargetBareMetalServerNetworkInterfaceReference struct { @@ -82081,9 +88101,18 @@ type FloatingIPTargetBareMetalServerNetworkInterfaceReference struct { Deleted *BareMetalServerNetworkInterfaceReferenceDeleted `json:"deleted,omitempty"` // The URL for this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href" validate:"required"` // The unique identifier for this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the identifier is that of the corresponding network + // attachment. ID *string `json:"id" validate:"required"` // The name for this bare metal server network interface. @@ -82144,9 +88173,18 @@ type FloatingIPTargetNetworkInterfaceReference struct { Deleted *NetworkInterfaceReferenceDeleted `json:"deleted,omitempty"` // The URL for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href" validate:"required"` // The unique identifier for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the identifier is that of the corresponding network + // attachment. ID *string `json:"id" validate:"required"` // The name for this instance network interface. @@ -82263,6 +88301,84 @@ func UnmarshalFloatingIPTargetPublicGatewayReference(m map[string]json.RawMessag return } +// FloatingIPTargetVirtualNetworkInterfaceReference : FloatingIPTargetVirtualNetworkInterfaceReference struct +// This model "extends" FloatingIPTarget +type FloatingIPTargetVirtualNetworkInterfaceReference struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VirtualNetworkInterfaceReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` + + // The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. + Name *string `json:"name" validate:"required"` + + // The primary IP for this virtual network interface. + PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The associated subnet. + Subnet *SubnetReference `json:"subnet" validate:"required"` +} + +// Constants associated with the FloatingIPTargetVirtualNetworkInterfaceReference.ResourceType property. +// The resource type. +const ( + FloatingIPTargetVirtualNetworkInterfaceReferenceResourceTypeVirtualNetworkInterfaceConst = "virtual_network_interface" +) + +func (*FloatingIPTargetVirtualNetworkInterfaceReference) isaFloatingIPTarget() bool { + return true +} + +// UnmarshalFloatingIPTargetVirtualNetworkInterfaceReference unmarshals an instance of FloatingIPTargetVirtualNetworkInterfaceReference from the specified map of raw messages. +func UnmarshalFloatingIPTargetVirtualNetworkInterfaceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetVirtualNetworkInterfaceReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVirtualNetworkInterfaceReferenceDeleted) + 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.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // FlowLogCollectorTargetPrototypeInstanceIdentity : Identifies a virtual server instance by a unique property. // Models which "extend" this model: // - FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID @@ -82312,6 +88428,47 @@ func UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentity(m map[string]json. return } +// FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity : Identifies an instance network attachment by a unique property. +// Models which "extend" this model: +// - FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID +// - FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref +// This model "extends" FlowLogCollectorTargetPrototype +type FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity struct { + // The unique identifier for this instance network attachment. + ID *string `json:"id,omitempty"` + + // The URL for this instance network attachment. + Href *string `json:"href,omitempty"` +} + +func (*FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity) isaFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity() bool { + return true +} + +type FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityIntf interface { + FlowLogCollectorTargetPrototypeIntf + isaFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity() bool +} + +func (*FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity unmarshals an instance of FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity) + 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 +} + // FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity : Identifies an instance network interface by a unique property. // Models which "extend" this model: // - FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID @@ -82319,9 +88476,18 @@ func UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentity(m map[string]json. // This model "extends" FlowLogCollectorTargetPrototype type FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity struct { // The unique identifier for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the identifier is that of the corresponding network + // attachment. ID *string `json:"id,omitempty"` // The URL for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href,omitempty"` } @@ -82451,6 +88617,127 @@ func UnmarshalFlowLogCollectorTargetPrototypeVPCIdentity(m map[string]json.RawMe return } +// FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. +// Models which "extend" this model: +// - FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID +// - FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref +// - FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN +// This model "extends" FlowLogCollectorTargetPrototype +type FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id,omitempty"` + + // The URL for this virtual network interface. + Href *string `json:"href,omitempty"` + + // The CRN for this virtual network interface. + CRN *string `json:"crn,omitempty"` +} + +func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity) isaFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +type FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityIntf interface { + FlowLogCollectorTargetPrototypeIntf + isaFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity() bool +} + +func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity unmarshals an instance of FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity) + 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, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetInstanceNetworkAttachmentReference : FlowLogCollectorTargetInstanceNetworkAttachmentReference struct +// This model "extends" FlowLogCollectorTarget +type FlowLogCollectorTargetInstanceNetworkAttachmentReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceNetworkAttachmentReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this instance network attachment. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance network attachment. + ID *string `json:"id" validate:"required"` + + // The name for this instance network attachment. The name is unique across all network attachments for the instance. + Name *string `json:"name" validate:"required"` + + // The primary IP address of the virtual network interface for the instance network + // attachment. + PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The subnet of the virtual network interface for the instance network attachment. + Subnet *SubnetReference `json:"subnet" validate:"required"` +} + +// Constants associated with the FlowLogCollectorTargetInstanceNetworkAttachmentReference.ResourceType property. +// The resource type. +const ( + FlowLogCollectorTargetInstanceNetworkAttachmentReferenceResourceTypeInstanceNetworkAttachmentConst = "instance_network_attachment" +) + +func (*FlowLogCollectorTargetInstanceNetworkAttachmentReference) isaFlowLogCollectorTarget() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetInstanceNetworkAttachmentReference unmarshals an instance of FlowLogCollectorTargetInstanceNetworkAttachmentReference from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetInstanceNetworkAttachmentReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetInstanceNetworkAttachmentReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceNetworkAttachmentReferenceDeleted) + 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.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // FlowLogCollectorTargetInstanceReference : FlowLogCollectorTargetInstanceReference struct // This model "extends" FlowLogCollectorTarget type FlowLogCollectorTargetInstanceReference struct { @@ -82510,9 +88797,18 @@ type FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext struct { Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` // The URL for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href" validate:"required"` // The unique identifier for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the identifier is that of the corresponding network + // attachment. ID *string `json:"id" validate:"required"` // The name for this instance network interface. @@ -82687,6 +88983,62 @@ func UnmarshalFlowLogCollectorTargetVPCReference(m map[string]json.RawMessage, r return } +// FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext : FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext struct +// This model "extends" FlowLogCollectorTarget +type FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` + + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` + + // The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext.ResourceType property. +// The resource type. +const ( + FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContextResourceTypeVirtualNetworkInterfaceConst = "virtual_network_interface" +) + +func (*FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext) isaFlowLogCollectorTarget() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext unmarshals an instance of FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext) + 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.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 +} + // ImageIdentityByCRN : ImageIdentityByCRN struct // This model "extends" ImageIdentity type ImageIdentityByCRN struct { @@ -83866,6 +90218,165 @@ func UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScaleProtot return } +// InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. +// Models which "extend" this model: +// - InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID +// - InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref +// - InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN +// This model "extends" InstanceNetworkAttachmentPrototypeVirtualNetworkInterface +type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id,omitempty"` + + // The URL for this virtual network interface. + Href *string `json:"href,omitempty"` + + // The CRN for this virtual network interface. + CRN *string `json:"crn,omitempty"` +} + +func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { + return true +} + +type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityIntf interface { + InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf + isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool +} + +func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +// UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity unmarshals an instance of InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity) + 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, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext : The virtual network interface for this target. +// This model "extends" InstanceNetworkAttachmentPrototypeVirtualNetworkInterface +type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext 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 whether this virtual network interface will be automatically deleted when + // `target` is deleted. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - `floating_ips` must not have more than one floating IP. + // + // If `false`: + // - Packets are passed unchanged to/from the virtual network interface, + // allowing the workload to perform any needed NAT operations. + // - `allow_ip_spoofing` must be `false`. + // - Can only be attached to a `target` with a `resource_type` of + // `bare_metal_server_network_attachment`. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` + + // Additional IP addresses to bind to the virtual network interface. Each item may be either a reserved IP identity, or + // a reserved IP prototype object which will be used to create a new reserved IP. All IP addresses must be in the + // primary IP's subnet. + // + // If reserved IP identities are provided, the specified reserved IPs must be unbound. + // + // If reserved IP prototype objects with addresses are provided, the addresses must be available on the virtual network + // interface's subnet. For any prototype objects that do not specify an address, an available address on the subnet + // will be automatically selected and reserved. + Ips []VirtualNetworkInterfaceIPPrototypeIntf `json:"ips,omitempty"` + + // The name for this virtual network interface. The name must not be used by another virtual network interface in the + // VPC. If unspecified, the name will be a hyphenated list of randomly-selected words. Names beginning with `ibm-` are + // reserved for provider-owned resources, and are not allowed. + Name *string `json:"name,omitempty"` + + // The primary IP address to bind to the virtual network interface. May be either a + // reserved IP identity, or a reserved IP prototype object which will be used to create a + // new reserved IP. + // + // If a reserved IP identity is provided, the specified reserved IP must be unbound. + // + // If a reserved IP prototype object with an address is provided, the address must be + // available on the virtual network interface's subnet. If no address is specified, + // an available address on the subnet will be automatically selected and reserved. + PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,omitempty"` + + // The resource group to use for this virtual network interface. If unspecified, the + // virtual server instance's resource group will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The security groups to use for this virtual network interface. If unspecified, the default security group of the VPC + // for the subnet is used. + SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` + + // The associated subnet. Required if `primary_ip` does not specify a reserved IP + // identity. + Subnet SubnetIdentityIntf `json:"subnet,omitempty"` +} + +func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +// UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext unmarshals an instance of InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // InstancePatchProfileInstanceProfileIdentityByHref : InstancePatchProfileInstanceProfileIdentityByHref struct // This model "extends" InstancePatchProfile type InstancePatchProfileInstanceProfileIdentityByHref struct { @@ -84365,8 +90876,8 @@ func UnmarshalInstancePlacementTargetPlacementGroupReference(m map[string]json.R return } -// InstanceProfileBandwidthDependent : The total bandwidth shared across the network interfaces and storage volumes of an instance with this profile depends -// on its configuration. +// InstanceProfileBandwidthDependent : The total bandwidth shared across the network attachments or network interfaces and storage volumes of an instance +// with this profile depends on its configuration. // This model "extends" InstanceProfileBandwidth type InstanceProfileBandwidthDependent struct { // The type for this profile field. @@ -84394,8 +90905,8 @@ func UnmarshalInstanceProfileBandwidthDependent(m map[string]json.RawMessage, re return } -// InstanceProfileBandwidthEnum : The permitted total bandwidth values (in megabits per second) shared across the network interfaces and storage -// volumes of an instance with this profile. +// InstanceProfileBandwidthEnum : The permitted total bandwidth values (in megabits per second) shared across the network attachments or network +// interfaces and storage volumes of an instance with this profile. // This model "extends" InstanceProfileBandwidth type InstanceProfileBandwidthEnum struct { // The default value for this profile field. @@ -84437,8 +90948,8 @@ func UnmarshalInstanceProfileBandwidthEnum(m map[string]json.RawMessage, result return } -// InstanceProfileBandwidthFixed : The total bandwidth (in megabits per second) shared across the network interfaces and storage volumes of an instance -// with this profile. +// InstanceProfileBandwidthFixed : The total bandwidth (in megabits per second) shared across the network attachments or network interfaces and storage +// volumes of an instance with this profile. // This model "extends" InstanceProfileBandwidth type InstanceProfileBandwidthFixed struct { // The type for this profile field. @@ -84473,8 +90984,8 @@ func UnmarshalInstanceProfileBandwidthFixed(m map[string]json.RawMessage, result return } -// InstanceProfileBandwidthRange : The permitted total bandwidth range (in megabits per second) shared across the network interfaces and storage volumes -// of an instance with this profile. +// InstanceProfileBandwidthRange : The permitted total bandwidth range (in megabits per second) shared across the network attachments or network +// interfaces and storage volumes of an instance with this profile. // This model "extends" InstanceProfileBandwidth type InstanceProfileBandwidthRange struct { // The default value for this profile field. @@ -85462,6 +91973,76 @@ func UnmarshalInstanceProfileNumaCountFixed(m map[string]json.RawMessage, result return } +// InstanceProfileNetworkAttachmentCountDependent : The number of network attachments supported on an instance with this profile is dependent on its configuration. +// This model "extends" InstanceProfileNetworkAttachmentCount +type InstanceProfileNetworkAttachmentCountDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileNetworkAttachmentCountDependent.Type property. +// The type for this profile field. +const ( + InstanceProfileNetworkAttachmentCountDependentTypeDependentConst = "dependent" +) + +func (*InstanceProfileNetworkAttachmentCountDependent) isaInstanceProfileNetworkAttachmentCount() bool { + return true +} + +// UnmarshalInstanceProfileNetworkAttachmentCountDependent unmarshals an instance of InstanceProfileNetworkAttachmentCountDependent from the specified map of raw messages. +func UnmarshalInstanceProfileNetworkAttachmentCountDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileNetworkAttachmentCountDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileNetworkAttachmentCountRange : The number of network attachments supported on an instance with this profile. +// This model "extends" InstanceProfileNetworkAttachmentCount +type InstanceProfileNetworkAttachmentCountRange struct { + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileNetworkAttachmentCountRange.Type property. +// The type for this profile field. +const ( + InstanceProfileNetworkAttachmentCountRangeTypeRangeConst = "range" +) + +func (*InstanceProfileNetworkAttachmentCountRange) isaInstanceProfileNetworkAttachmentCount() bool { + return true +} + +// UnmarshalInstanceProfileNetworkAttachmentCountRange unmarshals an instance of InstanceProfileNetworkAttachmentCountRange from the specified map of raw messages. +func UnmarshalInstanceProfileNetworkAttachmentCountRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileNetworkAttachmentCountRange) + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // InstanceProfileNetworkInterfaceCountDependent : The number of network interfaces supported on an instance with this profile is dependent on its configuration. // This model "extends" InstanceProfileNetworkInterfaceCount type InstanceProfileNetworkInterfaceCountDependent struct { @@ -85921,6 +92502,9 @@ func UnmarshalInstanceProfileVolumeBandwidthRange(m map[string]json.RawMessage, } // InstancePrototypeInstanceByCatalogOffering : Create an instance by using a catalog offering. +// Models which "extend" this model: +// - InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment +// - InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface // This model "extends" InstancePrototype type InstancePrototypeInstanceByCatalogOffering struct { // The availability policy to use for this virtual server instance. @@ -85979,7 +92563,8 @@ type InstancePrototypeInstanceByCatalogOffering struct { // The VPC this virtual server instance will reside in. // - // If specified, it must match the VPC for the subnets of the instance network interfaces. + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -86003,17 +92588,21 @@ type InstancePrototypeInstanceByCatalogOffering struct { // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` } -// NewInstancePrototypeInstanceByCatalogOffering : Instantiate InstancePrototypeInstanceByCatalogOffering (Generic Model Constructor) -func (*VpcV1) NewInstancePrototypeInstanceByCatalogOffering(catalogOffering InstanceCatalogOfferingPrototypeIntf, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstancePrototypeInstanceByCatalogOffering, err error) { - _model = &InstancePrototypeInstanceByCatalogOffering{ - CatalogOffering: catalogOffering, - PrimaryNetworkInterface: primaryNetworkInterface, - Zone: zone, - } - err = core.ValidateStruct(_model, "required parameters") - return +func (*InstancePrototypeInstanceByCatalogOffering) isaInstancePrototypeInstanceByCatalogOffering() bool { + return true +} + +type InstancePrototypeInstanceByCatalogOfferingIntf interface { + InstancePrototypeIntf + isaInstancePrototypeInstanceByCatalogOffering() bool } func (*InstancePrototypeInstanceByCatalogOffering) isaInstancePrototype() bool { @@ -86091,11 +92680,22 @@ func UnmarshalInstancePrototypeInstanceByCatalogOffering(m map[string]json.RawMe if err != nil { return } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } // InstancePrototypeInstanceByImage : Create an instance by using an image. +// Models which "extend" this model: +// - InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment +// - InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface // This model "extends" InstancePrototype type InstancePrototypeInstanceByImage struct { // The availability policy to use for this virtual server instance. @@ -86154,7 +92754,8 @@ type InstancePrototypeInstanceByImage struct { // The VPC this virtual server instance will reside in. // - // If specified, it must match the VPC for the subnets of the instance network interfaces. + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -86171,17 +92772,21 @@ type InstancePrototypeInstanceByImage struct { // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` } -// NewInstancePrototypeInstanceByImage : Instantiate InstancePrototypeInstanceByImage (Generic Model Constructor) -func (*VpcV1) NewInstancePrototypeInstanceByImage(image ImageIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstancePrototypeInstanceByImage, err error) { - _model = &InstancePrototypeInstanceByImage{ - Image: image, - PrimaryNetworkInterface: primaryNetworkInterface, - Zone: zone, - } - err = core.ValidateStruct(_model, "required parameters") - return +func (*InstancePrototypeInstanceByImage) isaInstancePrototypeInstanceByImage() bool { + return true +} + +type InstancePrototypeInstanceByImageIntf interface { + InstancePrototypeIntf + isaInstancePrototypeInstanceByImage() bool } func (*InstancePrototypeInstanceByImage) isaInstancePrototype() bool { @@ -86259,11 +92864,22 @@ func UnmarshalInstancePrototypeInstanceByImage(m map[string]json.RawMessage, res if err != nil { return } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } // InstancePrototypeInstanceBySourceSnapshot : Create an instance by using a snapshot. +// Models which "extend" this model: +// - InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment +// - InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface // This model "extends" InstancePrototype type InstancePrototypeInstanceBySourceSnapshot struct { // The availability policy to use for this virtual server instance. @@ -86322,7 +92938,8 @@ type InstancePrototypeInstanceBySourceSnapshot struct { // The VPC this virtual server instance will reside in. // - // If specified, it must match the VPC for the subnets of the instance network interfaces. + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -86336,17 +92953,21 @@ type InstancePrototypeInstanceBySourceSnapshot struct { // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` } -// NewInstancePrototypeInstanceBySourceSnapshot : Instantiate InstancePrototypeInstanceBySourceSnapshot (Generic Model Constructor) -func (*VpcV1) NewInstancePrototypeInstanceBySourceSnapshot(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstancePrototypeInstanceBySourceSnapshot, err error) { - _model = &InstancePrototypeInstanceBySourceSnapshot{ - BootVolumeAttachment: bootVolumeAttachment, - PrimaryNetworkInterface: primaryNetworkInterface, - Zone: zone, - } - err = core.ValidateStruct(_model, "required parameters") - return +func (*InstancePrototypeInstanceBySourceSnapshot) isaInstancePrototypeInstanceBySourceSnapshot() bool { + return true +} + +type InstancePrototypeInstanceBySourceSnapshotIntf interface { + InstancePrototypeIntf + isaInstancePrototypeInstanceBySourceSnapshot() bool } func (*InstancePrototypeInstanceBySourceSnapshot) isaInstancePrototype() bool { @@ -86420,12 +93041,23 @@ func UnmarshalInstancePrototypeInstanceBySourceSnapshot(m map[string]json.RawMes if err != nil { return } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } // InstancePrototypeInstanceBySourceTemplate : Create an instance by using an instance template. // +// The `primary_network_attachment` and `network_attachments` properties may only be specified if +// `primary_network_attachment` is specified in the source template. +// // The `primary_network_interface` and `network_interfaces` properties may only be specified if // `primary_network_interface` is specified in the source template. // This model "extends" InstancePrototype @@ -86486,7 +93118,8 @@ type InstancePrototypeInstanceBySourceTemplate struct { // The VPC this virtual server instance will reside in. // - // If specified, it must match the VPC for the subnets of the instance network interfaces. + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -86506,9 +93139,15 @@ type InstancePrototypeInstanceBySourceTemplate struct { // The image to use when provisioning the virtual server instance. Image ImageIdentityIntf `json:"image,omitempty"` + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + // The primary instance network interface to create. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` @@ -86595,10 +93234,18 @@ func UnmarshalInstancePrototypeInstanceBySourceTemplate(m map[string]json.RawMes if err != nil { return } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { return } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { return @@ -86616,6 +93263,9 @@ func UnmarshalInstancePrototypeInstanceBySourceTemplate(m map[string]json.RawMes } // InstancePrototypeInstanceByVolume : Create an instance by using a boot volume. +// Models which "extend" this model: +// - InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment +// - InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface // This model "extends" InstancePrototype type InstancePrototypeInstanceByVolume struct { // The availability policy to use for this virtual server instance. @@ -86674,7 +93324,8 @@ type InstancePrototypeInstanceByVolume struct { // The VPC this virtual server instance will reside in. // - // If specified, it must match the VPC for the subnets of the instance network interfaces. + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment for the virtual server instance. @@ -86688,17 +93339,21 @@ type InstancePrototypeInstanceByVolume struct { // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` } -// NewInstancePrototypeInstanceByVolume : Instantiate InstancePrototypeInstanceByVolume (Generic Model Constructor) -func (*VpcV1) NewInstancePrototypeInstanceByVolume(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceByVolumeContext, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstancePrototypeInstanceByVolume, err error) { - _model = &InstancePrototypeInstanceByVolume{ - BootVolumeAttachment: bootVolumeAttachment, - PrimaryNetworkInterface: primaryNetworkInterface, - Zone: zone, - } - err = core.ValidateStruct(_model, "required parameters") - return +func (*InstancePrototypeInstanceByVolume) isaInstancePrototypeInstanceByVolume() bool { + return true +} + +type InstancePrototypeInstanceByVolumeIntf interface { + InstancePrototypeIntf + isaInstancePrototypeInstanceByVolume() bool } func (*InstancePrototypeInstanceByVolume) isaInstancePrototype() bool { @@ -86772,6 +93427,14 @@ func UnmarshalInstancePrototypeInstanceByVolume(m map[string]json.RawMessage, re if err != nil { return } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -86870,6 +93533,9 @@ func UnmarshalInstanceTemplateIdentityByID(m map[string]json.RawMessage, result } // InstanceTemplatePrototypeInstanceTemplateByCatalogOffering : Create an instance template that creates instances by using a catalog offering. +// Models which "extend" this model: +// - InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment +// - InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface // This model "extends" InstanceTemplatePrototype type InstanceTemplatePrototypeInstanceTemplateByCatalogOffering struct { // The availability policy to use for this virtual server instance. @@ -86926,7 +93592,8 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOffering struct { // The VPC this virtual server instance will reside in. // - // If specified, it must match the VPC for the subnets of the instance network interfaces. + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -86950,17 +93617,21 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOffering struct { // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` } -// NewInstanceTemplatePrototypeInstanceTemplateByCatalogOffering : Instantiate InstanceTemplatePrototypeInstanceTemplateByCatalogOffering (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByCatalogOffering(catalogOffering InstanceCatalogOfferingPrototypeIntf, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstanceTemplatePrototypeInstanceTemplateByCatalogOffering, err error) { - _model = &InstanceTemplatePrototypeInstanceTemplateByCatalogOffering{ - CatalogOffering: catalogOffering, - PrimaryNetworkInterface: primaryNetworkInterface, - Zone: zone, - } - err = core.ValidateStruct(_model, "required parameters") - return +func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOffering) isaInstanceTemplatePrototypeInstanceTemplateByCatalogOffering() bool { + return true +} + +type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingIntf interface { + InstanceTemplatePrototypeIntf + isaInstanceTemplatePrototypeInstanceTemplateByCatalogOffering() bool } func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOffering) isaInstanceTemplatePrototype() bool { @@ -87038,11 +93709,22 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOffering(m map[s if err != nil { return } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } // InstanceTemplatePrototypeInstanceTemplateByImage : Create an instance template that creates instances by using an image. +// Models which "extend" this model: +// - InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment +// - InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface // This model "extends" InstanceTemplatePrototype type InstanceTemplatePrototypeInstanceTemplateByImage struct { // The availability policy to use for this virtual server instance. @@ -87099,7 +93781,8 @@ type InstanceTemplatePrototypeInstanceTemplateByImage struct { // The VPC this virtual server instance will reside in. // - // If specified, it must match the VPC for the subnets of the instance network interfaces. + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -87116,17 +93799,21 @@ type InstanceTemplatePrototypeInstanceTemplateByImage struct { // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` } -// NewInstanceTemplatePrototypeInstanceTemplateByImage : Instantiate InstanceTemplatePrototypeInstanceTemplateByImage (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByImage(image ImageIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstanceTemplatePrototypeInstanceTemplateByImage, err error) { - _model = &InstanceTemplatePrototypeInstanceTemplateByImage{ - Image: image, - PrimaryNetworkInterface: primaryNetworkInterface, - Zone: zone, - } - err = core.ValidateStruct(_model, "required parameters") - return +func (*InstanceTemplatePrototypeInstanceTemplateByImage) isaInstanceTemplatePrototypeInstanceTemplateByImage() bool { + return true +} + +type InstanceTemplatePrototypeInstanceTemplateByImageIntf interface { + InstanceTemplatePrototypeIntf + isaInstanceTemplatePrototypeInstanceTemplateByImage() bool } func (*InstanceTemplatePrototypeInstanceTemplateByImage) isaInstanceTemplatePrototype() bool { @@ -87204,11 +93891,22 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImage(m map[string]json if err != nil { return } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } // InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot : Create an instance template that creates instances by using a snapshot. +// Models which "extend" this model: +// - InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment +// - InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface // This model "extends" InstanceTemplatePrototype type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot struct { // The availability policy to use for this virtual server instance. @@ -87265,7 +93963,8 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot struct { // The VPC this virtual server instance will reside in. // - // If specified, it must match the VPC for the subnets of the instance network interfaces. + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -87279,17 +93978,21 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot struct { // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` } -// NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot : Instantiate InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot, err error) { - _model = &InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot{ - BootVolumeAttachment: bootVolumeAttachment, - PrimaryNetworkInterface: primaryNetworkInterface, - Zone: zone, - } - err = core.ValidateStruct(_model, "required parameters") - return +func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot) isaInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot() bool { + return true +} + +type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotIntf interface { + InstanceTemplatePrototypeIntf + isaInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot() bool } func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot) isaInstanceTemplatePrototype() bool { @@ -87363,6 +94066,14 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot(m map[st if err != nil { return } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -87424,7 +94135,8 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceTemplate struct { // The VPC this virtual server instance will reside in. // - // If specified, it must match the VPC for the subnets of the instance network interfaces. + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -87444,9 +94156,15 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceTemplate struct { // The image to use when provisioning the virtual server instance. Image ImageIdentityIntf `json:"image,omitempty"` + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + // The primary instance network interface to create. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` @@ -87533,205 +94251,23 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceTemplate(m map[st if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext : Create an instance by using a catalog offering. -// This model "extends" InstanceTemplate -type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The date and time that the instance template was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this instance template. - CRN *string `json:"crn" validate:"required"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The URL for this instance template. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name is unique across all instance templates in the region. - Name *string `json:"name" validate:"required"` - - // The placement restrictions to use for the virtual server instance. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - // The resource group for this instance template. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering - // or offering version to use when provisioning this virtual server instance. - // - // If an offering is specified, the latest version of that offering will be used. - // - // The specified offering or offering version may be in a different account in the same - // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject - // to IAM policies. - CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` -} - -func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext) isaInstanceTemplate() bool { - return true -} - -// UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext unmarshals an instance of InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - 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, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - 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, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { return } - err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { return } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) if err != nil { return } @@ -87743,9 +94279,12 @@ func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext(m return } -// InstanceTemplateInstanceByImageInstanceTemplateContext : Create an instance by using an image. +// InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext : Create an instance by using a catalog offering. +// Models which "extend" this model: +// - InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment +// - InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface // This model "extends" InstanceTemplate -type InstanceTemplateInstanceByImageInstanceTemplateContext struct { +type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` @@ -87812,7 +94351,225 @@ type InstanceTemplateInstanceByImageInstanceTemplateContext struct { // The VPC this virtual server instance will reside in. // - // If specified, it must match the VPC for the subnets of the instance network interfaces. + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering + // or offering version to use when provisioning this virtual server instance. + // + // If an offering is specified, the latest version of that offering will be used. + // + // The specified offering or offering version may be in a different account in the same + // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject + // to IAM policies. + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` +} + +func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext) isaInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext() bool { + return true +} + +type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextIntf interface { + InstanceTemplateIntf + isaInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext() bool +} + +func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext) isaInstanceTemplate() bool { + return true +} + +// UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext unmarshals an instance of InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + 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, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + 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, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateInstanceByImageInstanceTemplateContext : Create an instance by using an image. +// Models which "extend" this model: +// - InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment +// - InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface +// This model "extends" InstanceTemplate +type InstanceTemplateInstanceByImageInstanceTemplateContext struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -87825,10 +94582,25 @@ type InstanceTemplateInstanceByImageInstanceTemplateContext struct { NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` +} + +func (*InstanceTemplateInstanceByImageInstanceTemplateContext) isaInstanceTemplateInstanceByImageInstanceTemplateContext() bool { + return true +} + +type InstanceTemplateInstanceByImageInstanceTemplateContextIntf interface { + InstanceTemplateIntf + isaInstanceTemplateInstanceByImageInstanceTemplateContext() bool } func (*InstanceTemplateInstanceByImageInstanceTemplateContext) isaInstanceTemplate() bool { @@ -87922,11 +94694,22 @@ func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContext(m map[strin if err != nil { return } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } // InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext : Create an instance by using a snapshot. +// Models which "extend" this model: +// - InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment +// - InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface // This model "extends" InstanceTemplate type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext struct { // The availability policy to use for this virtual server instance. @@ -87995,22 +94778,38 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext struct { // The VPC this virtual server instance will reside in. // - // If specified, it must match the VPC for the subnets of the instance network interfaces. + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` } +func (*InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext) isaInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext() bool { + return true +} + +type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextIntf interface { + InstanceTemplateIntf + isaInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext() bool +} + func (*InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext) isaInstanceTemplate() bool { return true } @@ -88086,10 +94885,18 @@ func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext(m if err != nil { return } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { return } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { return @@ -91590,6 +98397,55 @@ func UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentity(m map[string]json return } +// ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. +// Models which "extend" this model: +// - ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID +// - ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref +// - ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN +// This model "extends" ReservedIPTargetPrototype +type ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id,omitempty"` + + // The URL for this virtual network interface. + Href *string `json:"href,omitempty"` + + // The CRN for this virtual network interface. + CRN *string `json:"crn,omitempty"` +} + +func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity) isaReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +type ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityIntf interface { + ReservedIPTargetPrototypeIntf + isaReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool +} + +func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity) isaReservedIPTargetPrototype() bool { + return true +} + +// UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity unmarshals an instance of ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity) + 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, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext : ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext struct // This model "extends" ReservedIPTarget type ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext struct { @@ -91598,9 +98454,18 @@ type ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext struc Deleted *BareMetalServerNetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` // The URL for this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href" validate:"required"` // The unique identifier for this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the identifier is that of the corresponding network + // attachment. ID *string `json:"id" validate:"required"` // The name for this bare metal server network interface. @@ -91826,9 +98691,18 @@ type ReservedIPTargetNetworkInterfaceReferenceTargetContext struct { Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` // The URL for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href" validate:"required"` // The unique identifier for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the identifier is that of the corresponding network + // attachment. ID *string `json:"id" validate:"required"` // The name for this instance network interface. @@ -93511,9 +100385,18 @@ type SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetC Deleted *BareMetalServerNetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` // The URL for this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href" validate:"required"` // The unique identifier for this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the identifier is that of the corresponding network + // attachment. ID *string `json:"id" validate:"required"` // The name for this bare metal server network interface. @@ -93696,9 +100579,18 @@ type SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext struct { Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` // The URL for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href" validate:"required"` // The unique identifier for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the identifier is that of the corresponding network + // attachment. ID *string `json:"id" validate:"required"` // The name for this instance network interface. @@ -93980,8 +100872,15 @@ func UnmarshalShareIdentityByID(m map[string]json.RawMessage, result interface{} return } -// ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup : The virtual network interface for this share mount target. The virtual network interface's VPC must not be used by a -// virtual network interface for another mount target for this share. +// ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup : The virtual network interface for this share mount target. The virtual network interface must: +// +// - have `allow_ip_spoofing` set to `false` +// - have `enable_infrastructure_nat` set to `true` +// - not be in the same VPC as an existing mount target for this share +// - not have `ips` other than the `primary_ip` address +// +// If an existing virtual network interface is specified, it must not have a floating IP bound to it, and it must not be +// the target of a flow log collector. // // Required if the share's `access_control_mode` is `security_group`. // This model "extends" ShareMountTargetPrototype @@ -94101,9 +101000,89 @@ func UnmarshalShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC(m return } +// ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. +// Models which "extend" this model: +// - ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID +// - ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref +// - ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN +// This model "extends" ShareMountTargetVirtualNetworkInterfacePrototype +type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id,omitempty"` + + // The URL for this virtual network interface. + Href *string `json:"href,omitempty"` + + // The CRN for this virtual network interface. + CRN *string `json:"crn,omitempty"` +} + +func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity) isaShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityIntf interface { + ShareMountTargetVirtualNetworkInterfacePrototypeIntf + isaShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity() bool +} + +func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity) isaShareMountTargetVirtualNetworkInterfacePrototype() bool { + return true +} + +// UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity unmarshals an instance of ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity) + 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, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext : The virtual network interface for this target. // This model "extends" ShareMountTargetVirtualNetworkInterfacePrototype type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext 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 whether this virtual network interface will be automatically deleted when + // `target` is deleted. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - `floating_ips` must not have more than one floating IP. + // + // If `false`: + // - Packets are passed unchanged to/from the virtual network interface, + // allowing the workload to perform any needed NAT operations. + // - `allow_ip_spoofing` must be `false`. + // - Can only be attached to a `target` with a `resource_type` of + // `bare_metal_server_network_attachment`. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` + + // Additional IP addresses to bind to the virtual network interface. Each item may be either a reserved IP identity, or + // a reserved IP prototype object which will be used to create a new reserved IP. All IP addresses must be in the + // primary IP's subnet. + // + // If reserved IP identities are provided, the specified reserved IPs must be unbound. + // + // If reserved IP prototype objects with addresses are provided, the addresses must be available on the virtual network + // interface's subnet. For any prototype objects that do not specify an address, an available address on the subnet + // will be automatically selected and reserved. + Ips []VirtualNetworkInterfaceIPPrototypeIntf `json:"ips,omitempty"` + // The name for this virtual network interface. The name must not be used by another virtual network interface in the // VPC. If unspecified, the name will be a hyphenated list of randomly-selected words. Names beginning with `ibm-` are // reserved for provider-owned resources, and are not allowed. @@ -94140,6 +101119,22 @@ func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePr // UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext unmarshals an instance of ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext from the specified map of raw messages. func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPPrototype) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return @@ -97627,6 +104622,89 @@ func UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernameP return } +// VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext : Identifies a reserved IP by a unique property. The reserved IP must be currently unbound and in the primary IP's +// subnet. +// Models which "extend" this model: +// - VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID +// - VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref +// This model "extends" VirtualNetworkInterfaceIPPrototype +type VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext struct { + // The unique identifier for this reserved IP. + ID *string `json:"id,omitempty"` + + // The URL for this reserved IP. + Href *string `json:"href,omitempty"` +} + +func (*VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext) isaVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext() bool { + return true +} + +type VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextIntf interface { + VirtualNetworkInterfaceIPPrototypeIntf + isaVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext() bool +} + +func (*VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext) isaVirtualNetworkInterfaceIPPrototype() bool { + return true +} + +// UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext unmarshals an instance of VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext) + 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 +} + +// VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext : The prototype for a new reserved IP. Must be in the primary IP's subnet. +// This model "extends" VirtualNetworkInterfaceIPPrototype +type VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext struct { + // The IP address to reserve, which must not already be reserved on the subnet. + // + // If unspecified, an available address on the subnet will automatically be selected. + Address *string `json:"address,omitempty"` + + // Indicates whether this reserved IP member will be automatically deleted when either + // `target` is deleted, or the reserved IP is unbound. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // The name for this reserved IP. The name must not be used by another reserved IP in the subnet. Names starting with + // `ibm-` are reserved for provider-owned resources, and are not allowed. If unspecified, the name will be a hyphenated + // list of randomly-selected words. + Name *string `json:"name,omitempty"` +} + +func (*VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) isaVirtualNetworkInterfaceIPPrototype() bool { + return true +} + +// UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext unmarshals an instance of VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext : Identifies a reserved IP by a unique property. Required if `subnet` is not specified. The reserved IP must be // currently unbound. // Models which "extend" this model: @@ -97710,6 +104788,105 @@ func UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtua return } +// VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext : VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext struct +// This model "extends" VirtualNetworkInterfaceTarget +type VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext struct { + // The URL for this bare metal server network attachment. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this bare metal server network attachment. + ID *string `json:"id" validate:"required"` + + // The name for this bare metal server network attachment. The name is unique across all network attachments for the + // bare metal server. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext.ResourceType property. +// The resource type. +const ( + VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContextResourceTypeBareMetalServerNetworkAttachmentConst = "bare_metal_server_network_attachment" +) + +func (*VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext) isaVirtualNetworkInterfaceTarget() bool { + return true +} + +// UnmarshalVirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext unmarshals an instance of VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext) + 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 +} + +// VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext : VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext struct +// This model "extends" VirtualNetworkInterfaceTarget +type VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext struct { + // The URL for this instance network attachment. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance network attachment. + ID *string `json:"id" validate:"required"` + + // The name for this instance network attachment. The name is unique across all network attachments for the instance. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext.ResourceType property. +// The resource type. +const ( + VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContextResourceTypeInstanceNetworkAttachmentConst = "instance_network_attachment" +) + +func (*VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext) isaVirtualNetworkInterfaceTarget() bool { + return true +} + +// UnmarshalVirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext unmarshals an instance of VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext) + 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 +} + // VirtualNetworkInterfaceTargetShareMountTargetReference : VirtualNetworkInterfaceTargetShareMountTargetReference struct // This model "extends" VirtualNetworkInterfaceTarget type VirtualNetworkInterfaceTargetShareMountTargetReference struct { @@ -98339,6 +105516,111 @@ func UnmarshalBackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCR return } +// BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct +// This model "extends" BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity +type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` +} + +// NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { + _model = &BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +// UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct +// This model "extends" BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity +type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` +} + +// NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { + _model = &BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +// UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct +// This model "extends" BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity +type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` +} + +// NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { + _model = &BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +// UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // EndpointGatewayReservedIPReservedIPIdentityByHref : EndpointGatewayReservedIPReservedIPIdentityByHref struct // This model "extends" EndpointGatewayReservedIPReservedIPIdentity type EndpointGatewayReservedIPReservedIPIdentityByHref struct { @@ -98514,6 +105796,10 @@ func UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentit // This model "extends" FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity type FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref struct { // The URL for this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href" validate:"required"` } @@ -98549,6 +105835,11 @@ func UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMe // This model "extends" FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity type FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID struct { // The unique identifier for this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the identifier is that of the corresponding network + // attachment. ID *string `json:"id" validate:"required"` } @@ -98584,6 +105875,10 @@ func UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMe // This model "extends" FloatingIPTargetPatchNetworkInterfaceIdentity type FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct { // The URL for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href" validate:"required"` } @@ -98619,6 +105914,11 @@ func UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdent // This model "extends" FloatingIPTargetPatchNetworkInterfaceIdentity type FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct { // The unique identifier for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the identifier is that of the corresponding network + // attachment. ID *string `json:"id" validate:"required"` } @@ -98650,10 +105950,119 @@ func UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdent return } +// FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct +// This model "extends" FloatingIPTargetPatchVirtualNetworkInterfaceIdentity +type FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` +} + +// NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { + _model = &FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaFloatingIPTargetPatchVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaFloatingIPTargetPatch() bool { + return true +} + +// UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. +func UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct +// This model "extends" FloatingIPTargetPatchVirtualNetworkInterfaceIdentity +type FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` +} + +// NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { + _model = &FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaFloatingIPTargetPatchVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaFloatingIPTargetPatch() bool { + return true +} + +// UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct +// This model "extends" FloatingIPTargetPatchVirtualNetworkInterfaceIdentity +type FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` +} + +// NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { + _model = &FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaFloatingIPTargetPatchVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaFloatingIPTargetPatch() bool { + return true +} + +// UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref : FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref struct // This model "extends" FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity type FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref struct { // The URL for this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href" validate:"required"` } @@ -98689,6 +106098,11 @@ func UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBa // This model "extends" FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity type FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID struct { // The unique identifier for this bare metal server network interface. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the identifier is that of the corresponding network + // attachment. ID *string `json:"id" validate:"required"` } @@ -98724,6 +106138,10 @@ func UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBa // This model "extends" FloatingIPTargetPrototypeNetworkInterfaceIdentity type FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct { // The URL for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href" validate:"required"` } @@ -98759,6 +106177,11 @@ func UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceI // This model "extends" FloatingIPTargetPrototypeNetworkInterfaceIdentity type FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct { // The unique identifier for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the identifier is that of the corresponding network + // attachment. ID *string `json:"id" validate:"required"` } @@ -98790,6 +106213,111 @@ func UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceI return } +// FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct +// This model "extends" FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity +type FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` +} + +// NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { + _model = &FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaFloatingIPTargetPrototype() bool { + return true +} + +// UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. +func UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct +// This model "extends" FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity +type FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` +} + +// NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { + _model = &FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaFloatingIPTargetPrototype() bool { + return true +} + +// UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct +// This model "extends" FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity +type FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` +} + +// NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { + _model = &FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaFloatingIPTargetPrototype() bool { + return true +} + +// UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN : FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN struct // This model "extends" FlowLogCollectorTargetPrototypeInstanceIdentity type FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN struct { @@ -98895,10 +106423,84 @@ func UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByI return } +// FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref : FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref struct +// This model "extends" FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity +type FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref struct { + // The URL for this instance network attachment. + Href *string `json:"href" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref : Instantiate FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref(href string) (_model *FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref, err error) { + _model = &FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref) isaFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref unmarshals an instance of FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID : FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID struct +// This model "extends" FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity +type FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID struct { + // The unique identifier for this instance network attachment. + ID *string `json:"id" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID : Instantiate FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID(id string) (_model *FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID, err error) { + _model = &FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID) isaFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID unmarshals an instance of FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct // This model "extends" FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity type FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct { // The URL for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href" validate:"required"` } @@ -98934,6 +106536,11 @@ func UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInte // This model "extends" FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity type FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct { // The unique identifier for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface, and the identifier is that of the corresponding network + // attachment. ID *string `json:"id" validate:"required"` } @@ -99175,6 +106782,111 @@ func UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID(m map[st return } +// FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct +// This model "extends" FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity +type FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { + _model = &FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct +// This model "extends" FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity +type FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { + _model = &FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct +// This model "extends" FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity +type FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { + _model = &FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec : InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec struct // Models which "extend" this model: // - InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup @@ -99318,84 +107030,4190 @@ type InstanceGroupManagerActionScheduledActionGroupTarget struct { // manager. Name *string `json:"name" validate:"required"` - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of the instance group action + // - `active`: Action is ready to be run + // - `completed`: Action was completed successfully + // - `failed`: Action could not be completed successfully + // - `incompatible`: Action parameters are not compatible with the group or manager + // - `omitted`: Action was not applied because this action's manager was disabled. + Status *string `json:"status" validate:"required"` + + // The date and time that the instance group manager action was updated. + UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` + + // The type of action for the instance group. + ActionType *string `json:"action_type" validate:"required"` + + // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min + // period. + CronSpec *string `json:"cron_spec,omitempty"` + + // The date and time the scheduled action was last applied. If absent, the action has never been applied. + LastAppliedAt *strfmt.DateTime `json:"last_applied_at,omitempty"` + + // The date and time the scheduled action will next run. If absent, the system is currently calculating the next run + // time. + NextRunAt *strfmt.DateTime `json:"next_run_at,omitempty"` + + Group *InstanceGroupManagerScheduledActionGroup `json:"group" validate:"required"` +} + +// Constants associated with the InstanceGroupManagerActionScheduledActionGroupTarget.ResourceType property. +// The resource type. +const ( + InstanceGroupManagerActionScheduledActionGroupTargetResourceTypeInstanceGroupManagerActionConst = "instance_group_manager_action" +) + +// Constants associated with the InstanceGroupManagerActionScheduledActionGroupTarget.Status property. +// The status of the instance group action +// - `active`: Action is ready to be run +// - `completed`: Action was completed successfully +// - `failed`: Action could not be completed successfully +// - `incompatible`: Action parameters are not compatible with the group or manager +// - `omitted`: Action was not applied because this action's manager was disabled. +const ( + InstanceGroupManagerActionScheduledActionGroupTargetStatusActiveConst = "active" + InstanceGroupManagerActionScheduledActionGroupTargetStatusCompletedConst = "completed" + InstanceGroupManagerActionScheduledActionGroupTargetStatusFailedConst = "failed" + InstanceGroupManagerActionScheduledActionGroupTargetStatusIncompatibleConst = "incompatible" + InstanceGroupManagerActionScheduledActionGroupTargetStatusOmittedConst = "omitted" +) + +// Constants associated with the InstanceGroupManagerActionScheduledActionGroupTarget.ActionType property. +// The type of action for the instance group. +const ( + InstanceGroupManagerActionScheduledActionGroupTargetActionTypeScheduledConst = "scheduled" +) + +func (*InstanceGroupManagerActionScheduledActionGroupTarget) isaInstanceGroupManagerActionScheduledAction() bool { + return true +} + +func (*InstanceGroupManagerActionScheduledActionGroupTarget) isaInstanceGroupManagerAction() bool { + return true +} + +// UnmarshalInstanceGroupManagerActionScheduledActionGroupTarget unmarshals an instance of InstanceGroupManagerActionScheduledActionGroupTarget from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionScheduledActionGroupTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionScheduledActionGroupTarget) + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete_timeout", &obj.AutoDeleteTimeout) + if err != nil { + return + } + 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, "name", &obj.Name) + 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, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "action_type", &obj.ActionType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "last_applied_at", &obj.LastAppliedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "next_run_at", &obj.NextRunAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroup) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionScheduledActionManagerTarget : InstanceGroupManagerActionScheduledActionManagerTarget struct +// This model "extends" InstanceGroupManagerActionScheduledAction +type InstanceGroupManagerActionScheduledActionManagerTarget struct { + // Indicates whether this scheduled action will be automatically deleted after it has completed and + // `auto_delete_timeout` hours have passed. At present, this is always + // `true`, but may be modifiable in the future. + AutoDelete *bool `json:"auto_delete" validate:"required"` + + // If `auto_delete` is `true`, and this scheduled action has finished, the hours after which it will be automatically + // deleted. If the value is `0`, the action will be deleted once it has finished. This value may be modifiable in the + // future. + AutoDeleteTimeout *int64 `json:"auto_delete_timeout" validate:"required"` + + // The date and time that the instance group manager action was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this instance group manager action. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager action. + ID *string `json:"id" validate:"required"` + + // The name for this instance group manager action. The name is unique across all actions for the instance group + // manager. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of the instance group action + // - `active`: Action is ready to be run + // - `completed`: Action was completed successfully + // - `failed`: Action could not be completed successfully + // - `incompatible`: Action parameters are not compatible with the group or manager + // - `omitted`: Action was not applied because this action's manager was disabled. + Status *string `json:"status" validate:"required"` + + // The date and time that the instance group manager action was updated. + UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` + + // The type of action for the instance group. + ActionType *string `json:"action_type" validate:"required"` + + // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min + // period. + CronSpec *string `json:"cron_spec,omitempty"` + + // The date and time the scheduled action was last applied. If absent, the action has never been applied. + LastAppliedAt *strfmt.DateTime `json:"last_applied_at,omitempty"` + + // The date and time the scheduled action will next run. If absent, the system is currently calculating the next run + // time. + NextRunAt *strfmt.DateTime `json:"next_run_at,omitempty"` + + Manager InstanceGroupManagerScheduledActionManagerIntf `json:"manager" validate:"required"` +} + +// Constants associated with the InstanceGroupManagerActionScheduledActionManagerTarget.ResourceType property. +// The resource type. +const ( + InstanceGroupManagerActionScheduledActionManagerTargetResourceTypeInstanceGroupManagerActionConst = "instance_group_manager_action" +) + +// Constants associated with the InstanceGroupManagerActionScheduledActionManagerTarget.Status property. +// The status of the instance group action +// - `active`: Action is ready to be run +// - `completed`: Action was completed successfully +// - `failed`: Action could not be completed successfully +// - `incompatible`: Action parameters are not compatible with the group or manager +// - `omitted`: Action was not applied because this action's manager was disabled. +const ( + InstanceGroupManagerActionScheduledActionManagerTargetStatusActiveConst = "active" + InstanceGroupManagerActionScheduledActionManagerTargetStatusCompletedConst = "completed" + InstanceGroupManagerActionScheduledActionManagerTargetStatusFailedConst = "failed" + InstanceGroupManagerActionScheduledActionManagerTargetStatusIncompatibleConst = "incompatible" + InstanceGroupManagerActionScheduledActionManagerTargetStatusOmittedConst = "omitted" +) + +// Constants associated with the InstanceGroupManagerActionScheduledActionManagerTarget.ActionType property. +// The type of action for the instance group. +const ( + InstanceGroupManagerActionScheduledActionManagerTargetActionTypeScheduledConst = "scheduled" +) + +func (*InstanceGroupManagerActionScheduledActionManagerTarget) isaInstanceGroupManagerActionScheduledAction() bool { + return true +} + +func (*InstanceGroupManagerActionScheduledActionManagerTarget) isaInstanceGroupManagerAction() bool { + return true +} + +// UnmarshalInstanceGroupManagerActionScheduledActionManagerTarget unmarshals an instance of InstanceGroupManagerActionScheduledActionManagerTarget from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionScheduledActionManagerTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionScheduledActionManagerTarget) + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete_timeout", &obj.AutoDeleteTimeout) + if err != nil { + return + } + 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, "name", &obj.Name) + 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, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "action_type", &obj.ActionType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "last_applied_at", &obj.LastAppliedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "next_run_at", &obj.NextRunAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManager) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref : InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref struct +// This model "extends" InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype +type InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref struct { + // The desired maximum number of instance group members at the scheduled time. + MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` + + // The desired minimum number of instance group members at the scheduled time. + MinMembershipCount *int64 `json:"min_membership_count,omitempty"` + + // The URL for this instance group manager. + Href *string `json:"href" validate:"required"` +} + +// NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref : Instantiate InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref (Generic Model Constructor) +func (*VpcV1) NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref(href string) (_model *InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref, err error) { + _model = &InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref) isaInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype() bool { + return true +} + +func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref) isaInstanceGroupManagerScheduledActionManagerPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref unmarshals an instance of InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref from the specified map of raw messages. +func UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref) + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID : InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID struct +// This model "extends" InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype +type InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID struct { + // The desired maximum number of instance group members at the scheduled time. + MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` + + // The desired minimum number of instance group members at the scheduled time. + MinMembershipCount *int64 `json:"min_membership_count,omitempty"` + + // The unique identifier for this instance group manager. + ID *string `json:"id" validate:"required"` +} + +// NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID : Instantiate InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID (Generic Model Constructor) +func (*VpcV1) NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID(id string) (_model *InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID, err error) { + _model = &InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID) isaInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype() bool { + return true +} + +func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID) isaInstanceGroupManagerScheduledActionManagerPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID unmarshals an instance of InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID from the specified map of raw messages. +func UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID) + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct +// This model "extends" InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity +type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` +} + +// NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { + _model = &InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +// UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct +// This model "extends" InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity +type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` +} + +// NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { + _model = &InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +// UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct +// This model "extends" InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity +type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` +} + +// NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { + _model = &InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +// UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN : InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN struct +// This model "extends" InstancePlacementTargetPatchDedicatedHostGroupIdentity +type InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN struct { + // The CRN for this dedicated host group. + CRN *string `json:"crn" validate:"required"` +} + +// NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN : Instantiate InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN(crn string) (_model *InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN, err error) { + _model = &InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) isaInstancePlacementTargetPatchDedicatedHostGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) isaInstancePlacementTargetPatch() bool { + return true +} + +// UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN unmarshals an instance of InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref : InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref struct +// This model "extends" InstancePlacementTargetPatchDedicatedHostGroupIdentity +type InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref struct { + // The URL for this dedicated host group. + Href *string `json:"href" validate:"required"` +} + +// NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref : Instantiate InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref(href string) (_model *InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref, err error) { + _model = &InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) isaInstancePlacementTargetPatchDedicatedHostGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) isaInstancePlacementTargetPatch() bool { + return true +} + +// UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref unmarshals an instance of InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID : InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID struct +// This model "extends" InstancePlacementTargetPatchDedicatedHostGroupIdentity +type InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID struct { + // The unique identifier for this dedicated host group. + ID *string `json:"id" validate:"required"` +} + +// NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID : Instantiate InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID(id string) (_model *InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID, err error) { + _model = &InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) isaInstancePlacementTargetPatchDedicatedHostGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) isaInstancePlacementTargetPatch() bool { + return true +} + +// UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID unmarshals an instance of InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN : InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN struct +// This model "extends" InstancePlacementTargetPatchDedicatedHostIdentity +type InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN struct { + // The CRN for this dedicated host. + CRN *string `json:"crn" validate:"required"` +} + +// NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN : Instantiate InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN(crn string) (_model *InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN, err error) { + _model = &InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN) isaInstancePlacementTargetPatchDedicatedHostIdentity() bool { + return true +} + +func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN) isaInstancePlacementTargetPatch() bool { + return true +} + +// UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN unmarshals an instance of InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref : InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref struct +// This model "extends" InstancePlacementTargetPatchDedicatedHostIdentity +type InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref struct { + // The URL for this dedicated host. + Href *string `json:"href" validate:"required"` +} + +// NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref : Instantiate InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref(href string) (_model *InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref, err error) { + _model = &InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref) isaInstancePlacementTargetPatchDedicatedHostIdentity() bool { + return true +} + +func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref) isaInstancePlacementTargetPatch() bool { + return true +} + +// UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref unmarshals an instance of InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID : InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID struct +// This model "extends" InstancePlacementTargetPatchDedicatedHostIdentity +type InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID struct { + // The unique identifier for this dedicated host. + ID *string `json:"id" validate:"required"` +} + +// NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID : Instantiate InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID(id string) (_model *InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID, err error) { + _model = &InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID) isaInstancePlacementTargetPatchDedicatedHostIdentity() bool { + return true +} + +func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID) isaInstancePlacementTargetPatch() bool { + return true +} + +// UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID unmarshals an instance of InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN : InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN struct +// This model "extends" InstancePlacementTargetPrototypeDedicatedHostGroupIdentity +type InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN struct { + // The CRN for this dedicated host group. + CRN *string `json:"crn" validate:"required"` +} + +// NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN : Instantiate InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN(crn string) (_model *InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN, err error) { + _model = &InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) isaInstancePlacementTargetPrototypeDedicatedHostGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref : InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref struct +// This model "extends" InstancePlacementTargetPrototypeDedicatedHostGroupIdentity +type InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref struct { + // The URL for this dedicated host group. + Href *string `json:"href" validate:"required"` +} + +// NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref : Instantiate InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref(href string) (_model *InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref, err error) { + _model = &InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) isaInstancePlacementTargetPrototypeDedicatedHostGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID : InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID struct +// This model "extends" InstancePlacementTargetPrototypeDedicatedHostGroupIdentity +type InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID struct { + // The unique identifier for this dedicated host group. + ID *string `json:"id" validate:"required"` +} + +// NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID : Instantiate InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID(id string) (_model *InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID, err error) { + _model = &InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) isaInstancePlacementTargetPrototypeDedicatedHostGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN : InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN struct +// This model "extends" InstancePlacementTargetPrototypeDedicatedHostIdentity +type InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN struct { + // The CRN for this dedicated host. + CRN *string `json:"crn" validate:"required"` +} + +// NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN : Instantiate InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN(crn string) (_model *InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN, err error) { + _model = &InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN) isaInstancePlacementTargetPrototypeDedicatedHostIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref : InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref struct +// This model "extends" InstancePlacementTargetPrototypeDedicatedHostIdentity +type InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref struct { + // The URL for this dedicated host. + Href *string `json:"href" validate:"required"` +} + +// NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref : Instantiate InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref(href string) (_model *InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref, err error) { + _model = &InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref) isaInstancePlacementTargetPrototypeDedicatedHostIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID : InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID struct +// This model "extends" InstancePlacementTargetPrototypeDedicatedHostIdentity +type InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID struct { + // The unique identifier for this dedicated host. + ID *string `json:"id" validate:"required"` +} + +// NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID : Instantiate InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID(id string) (_model *InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID, err error) { + _model = &InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) isaInstancePlacementTargetPrototypeDedicatedHostIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN : InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN struct +// This model "extends" InstancePlacementTargetPrototypePlacementGroupIdentity +type InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN struct { + // The CRN for this placement group. + CRN *string `json:"crn" validate:"required"` +} + +// NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN : Instantiate InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN(crn string) (_model *InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN, err error) { + _model = &InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN) isaInstancePlacementTargetPrototypePlacementGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN unmarshals an instance of InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref : InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref struct +// This model "extends" InstancePlacementTargetPrototypePlacementGroupIdentity +type InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref struct { + // The URL for this placement group. + Href *string `json:"href" validate:"required"` +} + +// NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref : Instantiate InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref(href string) (_model *InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref, err error) { + _model = &InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref) isaInstancePlacementTargetPrototypePlacementGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref unmarshals an instance of InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID : InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID struct +// This model "extends" InstancePlacementTargetPrototypePlacementGroupIdentity +type InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID struct { + // The unique identifier for this placement group. + ID *string `json:"id" validate:"required"` +} + +// NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID : Instantiate InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID(id string) (_model *InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID, err error) { + _model = &InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID) isaInstancePlacementTargetPrototypePlacementGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID unmarshals an instance of InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment : InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment struct +// This model "extends" InstancePrototypeInstanceByCatalogOffering +type InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance in the + // region. If unspecified, the name will be a hyphenated list of randomly-selected words. + // + // The system hostname will be based on this name. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` +} + +// NewInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment : Instantiate InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment(catalogOffering InstanceCatalogOfferingPrototypeIntf, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment, err error) { + _model = &InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment{ + CatalogOffering: catalogOffering, + PrimaryNetworkInterface: primaryNetworkInterface, + Zone: zone, + PrimaryNetworkAttachment: primaryNetworkAttachment, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment) isaInstancePrototypeInstanceByCatalogOffering() bool { + return true +} + +func (*InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment unmarshals an instance of InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface : InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface struct +// This model "extends" InstancePrototypeInstanceByCatalogOffering +type InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance in the + // region. If unspecified, the name will be a hyphenated list of randomly-selected words. + // + // The system hostname will be based on this name. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` +} + +// NewInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface : Instantiate InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface(catalogOffering InstanceCatalogOfferingPrototypeIntf, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface, err error) { + _model = &InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface{ + CatalogOffering: catalogOffering, + Zone: zone, + PrimaryNetworkInterface: primaryNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface) isaInstancePrototypeInstanceByCatalogOffering() bool { + return true +} + +func (*InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface unmarshals an instance of InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment : InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment struct +// This model "extends" InstancePrototypeInstanceByImage +type InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance in the + // region. If unspecified, the name will be a hyphenated list of randomly-selected words. + // + // The system hostname will be based on this name. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` +} + +// NewInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment : Instantiate InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment(image ImageIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment, err error) { + _model = &InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment{ + Image: image, + PrimaryNetworkInterface: primaryNetworkInterface, + Zone: zone, + PrimaryNetworkAttachment: primaryNetworkAttachment, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment) isaInstancePrototypeInstanceByImage() bool { + return true +} + +func (*InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment unmarshals an instance of InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface : InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface struct +// This model "extends" InstancePrototypeInstanceByImage +type InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance in the + // region. If unspecified, the name will be a hyphenated list of randomly-selected words. + // + // The system hostname will be based on this name. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` +} + +// NewInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface : Instantiate InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface(image ImageIdentityIntf, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface, err error) { + _model = &InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface{ + Image: image, + Zone: zone, + PrimaryNetworkInterface: primaryNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface) isaInstancePrototypeInstanceByImage() bool { + return true +} + +func (*InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface unmarshals an instance of InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment : InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment struct +// This model "extends" InstancePrototypeInstanceBySourceSnapshot +type InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance in the + // region. If unspecified, the name will be a hyphenated list of randomly-selected words. + // + // The system hostname will be based on this name. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` +} + +// NewInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment : Instantiate InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment, err error) { + _model = &InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment{ + BootVolumeAttachment: bootVolumeAttachment, + PrimaryNetworkInterface: primaryNetworkInterface, + Zone: zone, + PrimaryNetworkAttachment: primaryNetworkAttachment, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment) isaInstancePrototypeInstanceBySourceSnapshot() bool { + return true +} + +func (*InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment unmarshals an instance of InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface : InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface struct +// This model "extends" InstancePrototypeInstanceBySourceSnapshot +type InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance in the + // region. If unspecified, the name will be a hyphenated list of randomly-selected words. + // + // The system hostname will be based on this name. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` +} + +// NewInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface : Instantiate InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface, err error) { + _model = &InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface{ + BootVolumeAttachment: bootVolumeAttachment, + Zone: zone, + PrimaryNetworkInterface: primaryNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface) isaInstancePrototypeInstanceBySourceSnapshot() bool { + return true +} + +func (*InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface unmarshals an instance of InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment : InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment struct +// This model "extends" InstancePrototypeInstanceByVolume +type InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance in the + // region. If unspecified, the name will be a hyphenated list of randomly-selected words. + // + // The system hostname will be based on this name. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByVolumeContext `json:"boot_volume_attachment" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` +} + +// NewInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment : Instantiate InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceByVolumeContext, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment, err error) { + _model = &InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment{ + BootVolumeAttachment: bootVolumeAttachment, + PrimaryNetworkInterface: primaryNetworkInterface, + Zone: zone, + PrimaryNetworkAttachment: primaryNetworkAttachment, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment) isaInstancePrototypeInstanceByVolume() bool { + return true +} + +func (*InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment unmarshals an instance of InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByVolumeContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface : InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface struct +// This model "extends" InstancePrototypeInstanceByVolume +type InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance in the + // region. If unspecified, the name will be a hyphenated list of randomly-selected words. + // + // The system hostname will be based on this name. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByVolumeContext `json:"boot_volume_attachment" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` +} + +// NewInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface : Instantiate InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceByVolumeContext, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface, err error) { + _model = &InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface{ + BootVolumeAttachment: bootVolumeAttachment, + Zone: zone, + PrimaryNetworkInterface: primaryNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface) isaInstancePrototypeInstanceByVolume() bool { + return true +} + +func (*InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface unmarshals an instance of InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByVolumeContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment : InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment struct +// This model "extends" InstanceTemplatePrototypeInstanceTemplateByCatalogOffering +type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` +} + +// NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment : Instantiate InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment(catalogOffering InstanceCatalogOfferingPrototypeIntf, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment{ + CatalogOffering: catalogOffering, + PrimaryNetworkInterface: primaryNetworkInterface, + Zone: zone, + PrimaryNetworkAttachment: primaryNetworkAttachment, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment) isaInstanceTemplatePrototypeInstanceTemplateByCatalogOffering() bool { + return true +} + +func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment) isaInstanceTemplatePrototype() bool { + return true +} + +// UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface : InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface struct +// This model "extends" InstanceTemplatePrototypeInstanceTemplateByCatalogOffering +type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` +} + +// NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface : Instantiate InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface(catalogOffering InstanceCatalogOfferingPrototypeIntf, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface{ + CatalogOffering: catalogOffering, + Zone: zone, + PrimaryNetworkInterface: primaryNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface) isaInstanceTemplatePrototypeInstanceTemplateByCatalogOffering() bool { + return true +} + +func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface) isaInstanceTemplatePrototype() bool { + return true +} + +// UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment : InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment struct +// This model "extends" InstanceTemplatePrototypeInstanceTemplateByImage +type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` +} + +// NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment : Instantiate InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment(image ImageIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment{ + Image: image, + PrimaryNetworkInterface: primaryNetworkInterface, + Zone: zone, + PrimaryNetworkAttachment: primaryNetworkAttachment, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment) isaInstanceTemplatePrototypeInstanceTemplateByImage() bool { + return true +} + +func (*InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment) isaInstanceTemplatePrototype() bool { + return true +} + +// UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface : InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface struct +// This model "extends" InstanceTemplatePrototypeInstanceTemplateByImage +type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` +} + +// NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface : Instantiate InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface(image ImageIdentityIntf, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface{ + Image: image, + Zone: zone, + PrimaryNetworkInterface: primaryNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface) isaInstanceTemplatePrototypeInstanceTemplateByImage() bool { + return true +} + +func (*InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface) isaInstanceTemplatePrototype() bool { + return true +} + +// UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment : InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment struct +// This model "extends" InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot +type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` +} + +// NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment : Instantiate InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment{ + BootVolumeAttachment: bootVolumeAttachment, + PrimaryNetworkInterface: primaryNetworkInterface, + Zone: zone, + PrimaryNetworkAttachment: primaryNetworkAttachment, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment) isaInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot() bool { + return true +} + +func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment) isaInstanceTemplatePrototype() bool { + return true +} + +// UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface : InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface struct +// This model "extends" InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot +type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` +} + +// NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface : Instantiate InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface{ + BootVolumeAttachment: bootVolumeAttachment, + Zone: zone, + PrimaryNetworkInterface: primaryNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface) isaInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot() bool { + return true +} + +func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface) isaInstanceTemplatePrototype() bool { + return true +} + +// UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment : InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment struct +// This model "extends" InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext +type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` +} + +func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext() bool { + return true +} + +func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplate() bool { + return true +} + +// UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment unmarshals an instance of InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + 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, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + 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, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface : InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface struct +// This model "extends" InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext +type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` +} + +func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext() bool { + return true +} + +func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplate() bool { + return true +} + +// UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface unmarshals an instance of InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + 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, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + 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, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment : InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment struct +// This model "extends" InstanceTemplateInstanceByImageInstanceTemplateContext +type InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` +} + +func (*InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplateInstanceByImageInstanceTemplateContext() bool { + return true +} + +func (*InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplate() bool { + return true +} + +// UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment unmarshals an instance of InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + 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, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + 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, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface : InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface struct +// This model "extends" InstanceTemplateInstanceByImageInstanceTemplateContext +type InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - // The status of the instance group action - // - `active`: Action is ready to be run - // - `completed`: Action was completed successfully - // - `failed`: Action could not be completed successfully - // - `incompatible`: Action parameters are not compatible with the group or manager - // - `omitted`: Action was not applied because this action's manager was disabled. - Status *string `json:"status" validate:"required"` + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - // The date and time that the instance group manager action was updated. - UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - // The type of action for the instance group. - ActionType *string `json:"action_type" validate:"required"` + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` - // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min - // period. - CronSpec *string `json:"cron_spec,omitempty"` + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The date and time the scheduled action was last applied. If absent, the action has never been applied. - LastAppliedAt *strfmt.DateTime `json:"last_applied_at,omitempty"` + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` - // The date and time the scheduled action will next run. If absent, the system is currently calculating the next run - // time. - NextRunAt *strfmt.DateTime `json:"next_run_at,omitempty"` + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - Group *InstanceGroupManagerScheduledActionGroup `json:"group" validate:"required"` -} + // The image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image" validate:"required"` -// Constants associated with the InstanceGroupManagerActionScheduledActionGroupTarget.ResourceType property. -// The resource type. -const ( - InstanceGroupManagerActionScheduledActionGroupTargetResourceTypeInstanceGroupManagerActionConst = "instance_group_manager_action" -) + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` -// Constants associated with the InstanceGroupManagerActionScheduledActionGroupTarget.Status property. -// The status of the instance group action -// - `active`: Action is ready to be run -// - `completed`: Action was completed successfully -// - `failed`: Action could not be completed successfully -// - `incompatible`: Action parameters are not compatible with the group or manager -// - `omitted`: Action was not applied because this action's manager was disabled. -const ( - InstanceGroupManagerActionScheduledActionGroupTargetStatusActiveConst = "active" - InstanceGroupManagerActionScheduledActionGroupTargetStatusCompletedConst = "completed" - InstanceGroupManagerActionScheduledActionGroupTargetStatusFailedConst = "failed" - InstanceGroupManagerActionScheduledActionGroupTargetStatusIncompatibleConst = "incompatible" - InstanceGroupManagerActionScheduledActionGroupTargetStatusOmittedConst = "omitted" -) + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` -// Constants associated with the InstanceGroupManagerActionScheduledActionGroupTarget.ActionType property. -// The type of action for the instance group. -const ( - InstanceGroupManagerActionScheduledActionGroupTargetActionTypeScheduledConst = "scheduled" -) + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` +} -func (*InstanceGroupManagerActionScheduledActionGroupTarget) isaInstanceGroupManagerActionScheduledAction() bool { +func (*InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplateInstanceByImageInstanceTemplateContext() bool { return true } -func (*InstanceGroupManagerActionScheduledActionGroupTarget) isaInstanceGroupManagerAction() bool { +func (*InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplate() bool { return true } -// UnmarshalInstanceGroupManagerActionScheduledActionGroupTarget unmarshals an instance of InstanceGroupManagerActionScheduledActionGroupTarget from the specified map of raw messages. -func UnmarshalInstanceGroupManagerActionScheduledActionGroupTarget(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerActionScheduledActionGroupTarget) - err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) +// UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface unmarshals an instance of InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "auto_delete_timeout", &obj.AutoDeleteTimeout) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { return } @@ -99407,39 +111225,63 @@ func UnmarshalInstanceGroupManagerActionScheduledActionGroupTarget(m map[string] if err != nil { return } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { return } - err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { return } - err = core.UnmarshalPrimitive(m, "action_type", &obj.ActionType) + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { return } - err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) if err != nil { return } - err = core.UnmarshalPrimitive(m, "last_applied_at", &obj.LastAppliedAt) + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "next_run_at", &obj.NextRunAt) + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { return } - err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroup) + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { return } @@ -99447,106 +111289,110 @@ func UnmarshalInstanceGroupManagerActionScheduledActionGroupTarget(m map[string] return } -// InstanceGroupManagerActionScheduledActionManagerTarget : InstanceGroupManagerActionScheduledActionManagerTarget struct -// This model "extends" InstanceGroupManagerActionScheduledAction -type InstanceGroupManagerActionScheduledActionManagerTarget struct { - // Indicates whether this scheduled action will be automatically deleted after it has completed and - // `auto_delete_timeout` hours have passed. At present, this is always - // `true`, but may be modifiable in the future. - AutoDelete *bool `json:"auto_delete" validate:"required"` - - // If `auto_delete` is `true`, and this scheduled action has finished, the hours after which it will be automatically - // deleted. If the value is `0`, the action will be deleted once it has finished. This value may be modifiable in the - // future. - AutoDeleteTimeout *int64 `json:"auto_delete_timeout" validate:"required"` +// InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment : InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment struct +// This model "extends" InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext +type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - // The date and time that the instance group manager action was created. + // The date and time that the instance template was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - // The URL for this instance group manager action. + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The URL for this instance template. Href *string `json:"href" validate:"required"` - // The unique identifier for this instance group manager action. + // The unique identifier for this instance template. ID *string `json:"id" validate:"required"` - // The name for this instance group manager action. The name is unique across all actions for the instance group - // manager. + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name is unique across all instance templates in the region. Name *string `json:"name" validate:"required"` - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The status of the instance group action - // - `active`: Action is ready to be run - // - `completed`: Action was completed successfully - // - `failed`: Action could not be completed successfully - // - `incompatible`: Action parameters are not compatible with the group or manager - // - `omitted`: Action was not applied because this action's manager was disabled. - Status *string `json:"status" validate:"required"` + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - // The date and time that the instance group manager action was updated. - UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - // The type of action for the instance group. - ActionType *string `json:"action_type" validate:"required"` + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min - // period. - CronSpec *string `json:"cron_spec,omitempty"` + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` - // The date and time the scheduled action was last applied. If absent, the action has never been applied. - LastAppliedAt *strfmt.DateTime `json:"last_applied_at,omitempty"` + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The date and time the scheduled action will next run. If absent, the system is currently calculating the next run - // time. - NextRunAt *strfmt.DateTime `json:"next_run_at,omitempty"` + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` - Manager InstanceGroupManagerScheduledActionManagerIntf `json:"manager" validate:"required"` -} + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` -// Constants associated with the InstanceGroupManagerActionScheduledActionManagerTarget.ResourceType property. -// The resource type. -const ( - InstanceGroupManagerActionScheduledActionManagerTargetResourceTypeInstanceGroupManagerActionConst = "instance_group_manager_action" -) + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` -// Constants associated with the InstanceGroupManagerActionScheduledActionManagerTarget.Status property. -// The status of the instance group action -// - `active`: Action is ready to be run -// - `completed`: Action was completed successfully -// - `failed`: Action could not be completed successfully -// - `incompatible`: Action parameters are not compatible with the group or manager -// - `omitted`: Action was not applied because this action's manager was disabled. -const ( - InstanceGroupManagerActionScheduledActionManagerTargetStatusActiveConst = "active" - InstanceGroupManagerActionScheduledActionManagerTargetStatusCompletedConst = "completed" - InstanceGroupManagerActionScheduledActionManagerTargetStatusFailedConst = "failed" - InstanceGroupManagerActionScheduledActionManagerTargetStatusIncompatibleConst = "incompatible" - InstanceGroupManagerActionScheduledActionManagerTargetStatusOmittedConst = "omitted" -) + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` -// Constants associated with the InstanceGroupManagerActionScheduledActionManagerTarget.ActionType property. -// The type of action for the instance group. -const ( - InstanceGroupManagerActionScheduledActionManagerTargetActionTypeScheduledConst = "scheduled" -) + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` -func (*InstanceGroupManagerActionScheduledActionManagerTarget) isaInstanceGroupManagerActionScheduledAction() bool { + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` +} + +func (*InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext() bool { return true } -func (*InstanceGroupManagerActionScheduledActionManagerTarget) isaInstanceGroupManagerAction() bool { +func (*InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplate() bool { return true } -// UnmarshalInstanceGroupManagerActionScheduledActionManagerTarget unmarshals an instance of InstanceGroupManagerActionScheduledActionManagerTarget from the specified map of raw messages. -func UnmarshalInstanceGroupManagerActionScheduledActionManagerTarget(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerActionScheduledActionManagerTarget) - err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "auto_delete_timeout", &obj.AutoDeleteTimeout) +// UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment unmarshals an instance of InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } @@ -99554,285 +111400,83 @@ func UnmarshalInstanceGroupManagerActionScheduledActionManagerTarget(m map[strin if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) 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, "updated_at", &obj.UpdatedAt) + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { return } - err = core.UnmarshalPrimitive(m, "action_type", &obj.ActionType) + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "last_applied_at", &obj.LastAppliedAt) + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "next_run_at", &obj.NextRunAt) + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { return } - err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManager) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref : InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref struct -// This model "extends" InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype -type InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref struct { - // The desired maximum number of instance group members at the scheduled time. - MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` - - // The desired minimum number of instance group members at the scheduled time. - MinMembershipCount *int64 `json:"min_membership_count,omitempty"` - - // The URL for this instance group manager. - Href *string `json:"href" validate:"required"` -} - -// NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref : Instantiate InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref (Generic Model Constructor) -func (*VpcV1) NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref(href string) (_model *InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref, err error) { - _model = &InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref) isaInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype() bool { - return true -} - -func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref) isaInstanceGroupManagerScheduledActionManagerPrototype() bool { - return true -} - -// UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref unmarshals an instance of InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref from the specified map of raw messages. -func UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref) - err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { return } - err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID : InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID struct -// This model "extends" InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype -type InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID struct { - // The desired maximum number of instance group members at the scheduled time. - MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` - - // The desired minimum number of instance group members at the scheduled time. - MinMembershipCount *int64 `json:"min_membership_count,omitempty"` - - // The unique identifier for this instance group manager. - ID *string `json:"id" validate:"required"` -} - -// NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID : Instantiate InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID (Generic Model Constructor) -func (*VpcV1) NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID(id string) (_model *InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID, err error) { - _model = &InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID) isaInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype() bool { - return true -} - -func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID) isaInstanceGroupManagerScheduledActionManagerPrototype() bool { - return true -} - -// UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID unmarshals an instance of InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID from the specified map of raw messages. -func UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID) - err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { return } - err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) if err != nil { return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN : InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN struct -// This model "extends" InstancePlacementTargetPatchDedicatedHostGroupIdentity -type InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN struct { - // The CRN for this dedicated host group. - CRN *string `json:"crn" validate:"required"` -} - -// NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN : Instantiate InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN(crn string) (_model *InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN, err error) { - _model = &InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) isaInstancePlacementTargetPatchDedicatedHostGroupIdentity() bool { - return true -} - -func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) isaInstancePlacementTargetPatch() bool { - return true -} - -// UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN unmarshals an instance of InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref : InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref struct -// This model "extends" InstancePlacementTargetPatchDedicatedHostGroupIdentity -type InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref struct { - // The URL for this dedicated host group. - Href *string `json:"href" validate:"required"` -} - -// NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref : Instantiate InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref(href string) (_model *InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref, err error) { - _model = &InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) isaInstancePlacementTargetPatchDedicatedHostGroupIdentity() bool { - return true -} - -func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) isaInstancePlacementTargetPatch() bool { - return true -} - -// UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref unmarshals an instance of InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID : InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID struct -// This model "extends" InstancePlacementTargetPatchDedicatedHostGroupIdentity -type InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID struct { - // The unique identifier for this dedicated host group. - ID *string `json:"id" validate:"required"` -} - -// NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID : Instantiate InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID(id string) (_model *InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID, err error) { - _model = &InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) isaInstancePlacementTargetPatchDedicatedHostGroupIdentity() bool { - return true -} - -func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) isaInstancePlacementTargetPatch() bool { - return true -} - -// UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID unmarshals an instance of InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN : InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN struct -// This model "extends" InstancePlacementTargetPatchDedicatedHostIdentity -type InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN struct { - // The CRN for this dedicated host. - CRN *string `json:"crn" validate:"required"` -} - -// NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN : Instantiate InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN(crn string) (_model *InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN, err error) { - _model = &InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN) isaInstancePlacementTargetPatchDedicatedHostIdentity() bool { - return true -} - -func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN) isaInstancePlacementTargetPatch() bool { - return true -} - -// UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN unmarshals an instance of InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { return } @@ -99840,384 +111484,194 @@ func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIden return } -// InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref : InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref struct -// This model "extends" InstancePlacementTargetPatchDedicatedHostIdentity -type InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref struct { - // The URL for this dedicated host. - Href *string `json:"href" validate:"required"` -} +// InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface : InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface struct +// This model "extends" InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext +type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` -// NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref : Instantiate InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref(href string) (_model *InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref, err error) { - _model = &InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` -func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref) isaInstancePlacementTargetPatchDedicatedHostIdentity() bool { - return true -} + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` -func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref) isaInstancePlacementTargetPatch() bool { - return true -} + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` -// UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref unmarshals an instance of InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} + // The URL for this instance template. + Href *string `json:"href" validate:"required"` -// InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID : InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID struct -// This model "extends" InstancePlacementTargetPatchDedicatedHostIdentity -type InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID struct { - // The unique identifier for this dedicated host. + // The unique identifier for this instance template. ID *string `json:"id" validate:"required"` -} -// NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID : Instantiate InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID(id string) (_model *InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID, err error) { - _model = &InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` -func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID) isaInstancePlacementTargetPatchDedicatedHostIdentity() bool { - return true -} + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` -func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID) isaInstancePlacementTargetPatch() bool { - return true -} + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` -// UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID unmarshals an instance of InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` -// InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN : InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN struct -// This model "extends" InstancePlacementTargetPrototypeDedicatedHostGroupIdentity -type InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN struct { - // The CRN for this dedicated host group. - CRN *string `json:"crn" validate:"required"` -} + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` -// NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN : Instantiate InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN(crn string) (_model *InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN, err error) { - _model = &InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` -func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) isaInstancePlacementTargetPrototypeDedicatedHostGroupIdentity() bool { - return true -} + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` -func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) isaInstancePlacementTargetPrototype() bool { - return true -} + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` -// UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` -// InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref : InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref struct -// This model "extends" InstancePlacementTargetPrototypeDedicatedHostGroupIdentity -type InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref struct { - // The URL for this dedicated host group. - Href *string `json:"href" validate:"required"` -} + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` -// NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref : Instantiate InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref(href string) (_model *InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref, err error) { - _model = &InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` -func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) isaInstancePlacementTargetPrototypeDedicatedHostGroupIdentity() bool { - return true -} + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` -func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) isaInstancePlacementTargetPrototype() bool { - return true -} + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` -// UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` -// InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID : InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID struct -// This model "extends" InstancePlacementTargetPrototypeDedicatedHostGroupIdentity -type InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID struct { - // The unique identifier for this dedicated host group. - ID *string `json:"id" validate:"required"` -} + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` -// NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID : Instantiate InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID(id string) (_model *InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID, err error) { - _model = &InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` } -func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) isaInstancePlacementTargetPrototypeDedicatedHostGroupIdentity() bool { +func (*InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext() bool { return true } -func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) isaInstancePlacementTargetPrototype() bool { +func (*InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplate() bool { return true } -// UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) +// UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface unmarshals an instance of InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN : InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN struct -// This model "extends" InstancePlacementTargetPrototypeDedicatedHostIdentity -type InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN struct { - // The CRN for this dedicated host. - CRN *string `json:"crn" validate:"required"` -} - -// NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN : Instantiate InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN(crn string) (_model *InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN, err error) { - _model = &InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN{ - CRN: core.StringPtr(crn), + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN) isaInstancePlacementTargetPrototypeDedicatedHostIdentity() bool { - return true -} - -func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN) isaInstancePlacementTargetPrototype() bool { - return true -} - -// UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN) err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref : InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref struct -// This model "extends" InstancePlacementTargetPrototypeDedicatedHostIdentity -type InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref struct { - // The URL for this dedicated host. - Href *string `json:"href" validate:"required"` -} - -// NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref : Instantiate InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref(href string) (_model *InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref, err error) { - _model = &InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref{ - Href: core.StringPtr(href), + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref) isaInstancePlacementTargetPrototypeDedicatedHostIdentity() bool { - return true -} - -func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref) isaInstancePlacementTargetPrototype() bool { - return true -} - -// UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID : InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID struct -// This model "extends" InstancePlacementTargetPrototypeDedicatedHostIdentity -type InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID struct { - // The unique identifier for this dedicated host. - ID *string `json:"id" validate:"required"` -} - -// NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID : Instantiate InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID(id string) (_model *InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID, err error) { - _model = &InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) isaInstancePlacementTargetPrototypeDedicatedHostIdentity() bool { - return true -} - -func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) isaInstancePlacementTargetPrototype() bool { - return true -} - -// UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN : InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN struct -// This model "extends" InstancePlacementTargetPrototypePlacementGroupIdentity -type InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN struct { - // The CRN for this placement group. - CRN *string `json:"crn" validate:"required"` -} - -// NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN : Instantiate InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN(crn string) (_model *InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN, err error) { - _model = &InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN{ - CRN: core.StringPtr(crn), + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN) isaInstancePlacementTargetPrototypePlacementGroupIdentity() bool { - return true -} - -func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN) isaInstancePlacementTargetPrototype() bool { - return true -} - -// UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN unmarshals an instance of InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref : InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref struct -// This model "extends" InstancePlacementTargetPrototypePlacementGroupIdentity -type InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref struct { - // The URL for this placement group. - Href *string `json:"href" validate:"required"` -} - -// NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref : Instantiate InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref(href string) (_model *InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref, err error) { - _model = &InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref{ - Href: core.StringPtr(href), + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref) isaInstancePlacementTargetPrototypePlacementGroupIdentity() bool { - return true -} - -func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref) isaInstancePlacementTargetPrototype() bool { - return true -} - -// UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref unmarshals an instance of InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID : InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID struct -// This model "extends" InstancePlacementTargetPrototypePlacementGroupIdentity -type InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID struct { - // The unique identifier for this placement group. - ID *string `json:"id" validate:"required"` -} - -// NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID : Instantiate InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID(id string) (_model *InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID, err error) { - _model = &InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID{ - ID: core.StringPtr(id), + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID) isaInstancePlacementTargetPrototypePlacementGroupIdentity() bool { - return true -} - -func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID) isaInstancePlacementTargetPrototype() bool { - return true -} - -// UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID unmarshals an instance of InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { return } @@ -100785,6 +112239,111 @@ func UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIde return } +// ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct +// This model "extends" ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity +type ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` +} + +// NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { + _model = &ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaReservedIPTargetPrototype() bool { + return true +} + +// UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. +func UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct +// This model "extends" ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity +type ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` +} + +// NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { + _model = &ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaReservedIPTargetPrototype() bool { + return true +} + +// UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct +// This model "extends" ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity +type ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` +} + +// NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { + _model = &ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaReservedIPTargetPrototype() bool { + return true +} + +// UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP : RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP struct // This model "extends" RouteNextHopPatchRouteNextHopIP type RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP struct { @@ -101299,6 +112858,181 @@ func UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroup return } +// ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct +// This model "extends" ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity +type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` +} + +// NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { + _model = &ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaShareMountTargetVirtualNetworkInterfacePrototype() bool { + return true +} + +// UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. +func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct +// This model "extends" ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity +type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` +} + +// NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { + _model = &ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaShareMountTargetVirtualNetworkInterfacePrototype() bool { + return true +} + +// UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct +// This model "extends" ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity +type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` +} + +// NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { + _model = &ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaShareMountTargetVirtualNetworkInterfacePrototype() bool { + return true +} + +// UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref : VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref struct +// This model "extends" VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext +type VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref struct { + // The URL for this reserved IP. + Href *string `json:"href" validate:"required"` +} + +// NewVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref : Instantiate VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref (Generic Model Constructor) +func (*VpcV1) NewVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref(href string) (_model *VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref, err error) { + _model = &VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref) isaVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext() bool { + return true +} + +func (*VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref) isaVirtualNetworkInterfaceIPPrototype() bool { + return true +} + +// UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref unmarshals an instance of VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID : VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID struct +// This model "extends" VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext +type VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID struct { + // The unique identifier for this reserved IP. + ID *string `json:"id" validate:"required"` +} + +// NewVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID : Instantiate VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID (Generic Model Constructor) +func (*VpcV1) NewVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID(id string) (_model *VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID, err error) { + _model = &VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID) isaVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext() bool { + return true +} + +func (*VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID) isaVirtualNetworkInterfaceIPPrototype() bool { + return true +} + +// UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID unmarshals an instance of VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref : VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref struct // This model "extends" VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext type VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref struct { @@ -104073,6 +115807,91 @@ func (pager *BareMetalServersPager) GetAll() (allItems []BareMetalServer, err er return pager.GetAllWithContext(context.Background()) } +// BareMetalServerNetworkAttachmentsPager can be used to simplify the use of the "ListBareMetalServerNetworkAttachments" method. +type BareMetalServerNetworkAttachmentsPager struct { + hasNext bool + options *ListBareMetalServerNetworkAttachmentsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewBareMetalServerNetworkAttachmentsPager returns a new BareMetalServerNetworkAttachmentsPager instance. +func (vpc *VpcV1) NewBareMetalServerNetworkAttachmentsPager(options *ListBareMetalServerNetworkAttachmentsOptions) (pager *BareMetalServerNetworkAttachmentsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListBareMetalServerNetworkAttachmentsOptions = *options + pager = &BareMetalServerNetworkAttachmentsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *BareMetalServerNetworkAttachmentsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *BareMetalServerNetworkAttachmentsPager) GetNextWithContext(ctx context.Context) (page []BareMetalServerNetworkAttachmentIntf, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListBareMetalServerNetworkAttachmentsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.NetworkAttachments + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *BareMetalServerNetworkAttachmentsPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerNetworkAttachmentIntf, err error) { + for pager.HasNext() { + var nextPage []BareMetalServerNetworkAttachmentIntf + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *BareMetalServerNetworkAttachmentsPager) GetNext() (page []BareMetalServerNetworkAttachmentIntf, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *BareMetalServerNetworkAttachmentsPager) GetAll() (allItems []BareMetalServerNetworkAttachmentIntf, err error) { + return pager.GetAllWithContext(context.Background()) +} + // BareMetalServerNetworkInterfacesPager can be used to simplify the use of the "ListBareMetalServerNetworkInterfaces" method. type BareMetalServerNetworkInterfacesPager struct { hasNext bool @@ -104838,6 +116657,176 @@ func (pager *VirtualNetworkInterfacesPager) GetAll() (allItems []VirtualNetworkI return pager.GetAllWithContext(context.Background()) } +// NetworkInterfaceFloatingIpsPager can be used to simplify the use of the "ListNetworkInterfaceFloatingIps" method. +type NetworkInterfaceFloatingIpsPager struct { + hasNext bool + options *ListNetworkInterfaceFloatingIpsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewNetworkInterfaceFloatingIpsPager returns a new NetworkInterfaceFloatingIpsPager instance. +func (vpc *VpcV1) NewNetworkInterfaceFloatingIpsPager(options *ListNetworkInterfaceFloatingIpsOptions) (pager *NetworkInterfaceFloatingIpsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListNetworkInterfaceFloatingIpsOptions = *options + pager = &NetworkInterfaceFloatingIpsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *NetworkInterfaceFloatingIpsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *NetworkInterfaceFloatingIpsPager) GetNextWithContext(ctx context.Context) (page []FloatingIPReference, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListNetworkInterfaceFloatingIpsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.FloatingIps + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *NetworkInterfaceFloatingIpsPager) GetAllWithContext(ctx context.Context) (allItems []FloatingIPReference, err error) { + for pager.HasNext() { + var nextPage []FloatingIPReference + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *NetworkInterfaceFloatingIpsPager) GetNext() (page []FloatingIPReference, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *NetworkInterfaceFloatingIpsPager) GetAll() (allItems []FloatingIPReference, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// VirtualNetworkInterfaceIpsPager can be used to simplify the use of the "ListVirtualNetworkInterfaceIps" method. +type VirtualNetworkInterfaceIpsPager struct { + hasNext bool + options *ListVirtualNetworkInterfaceIpsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewVirtualNetworkInterfaceIpsPager returns a new VirtualNetworkInterfaceIpsPager instance. +func (vpc *VpcV1) NewVirtualNetworkInterfaceIpsPager(options *ListVirtualNetworkInterfaceIpsOptions) (pager *VirtualNetworkInterfaceIpsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListVirtualNetworkInterfaceIpsOptions = *options + pager = &VirtualNetworkInterfaceIpsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VirtualNetworkInterfaceIpsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *VirtualNetworkInterfaceIpsPager) GetNextWithContext(ctx context.Context) (page []ReservedIPReference, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListVirtualNetworkInterfaceIpsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Ips + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *VirtualNetworkInterfaceIpsPager) GetAllWithContext(ctx context.Context) (allItems []ReservedIPReference, err error) { + for pager.HasNext() { + var nextPage []ReservedIPReference + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *VirtualNetworkInterfaceIpsPager) GetNext() (page []ReservedIPReference, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *VirtualNetworkInterfaceIpsPager) GetAll() (allItems []ReservedIPReference, err error) { + return pager.GetAllWithContext(context.Background()) +} + // PublicGatewaysPager can be used to simplify the use of the "ListPublicGateways" method. type PublicGatewaysPager struct { hasNext bool diff --git a/vpcv1/vpc_v1_test.go b/vpcv1/vpc_v1_test.go index becfb0a..fd0ab11 100644 --- a/vpcv1/vpc_v1_test.go +++ b/vpcv1/vpc_v1_test.go @@ -1937,7 +1937,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - 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_internet_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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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"}], "advertise_routes_to": ["transit_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_internet_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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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() { @@ -1994,7 +1994,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - 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_internet_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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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"}], "advertise_routes_to": ["transit_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_internet_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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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() { @@ -5082,7 +5082,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", "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", "priority": 1, "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", "advertise": false, "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", "priority": 1, "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() { @@ -5145,7 +5145,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", "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", "priority": 1, "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", "advertise": false, "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", "priority": 1, "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() { @@ -5296,9 +5296,9 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) requestNumber++ if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"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","priority":1,"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}`) + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"routes":[{"action":"delegate","advertise":false,"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","priority":1,"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}`) } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"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","priority":1,"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}`) + fmt.Fprintf(res, "%s", `{"routes":[{"action":"delegate","advertise":false,"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","priority":1,"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}`) } else { res.WriteHeader(400) } @@ -5399,6 +5399,7 @@ var _ = Describe(`VpcV1`, func() { createVPCRouteOptionsModel.Destination = core.StringPtr("192.168.3.0/24") createVPCRouteOptionsModel.Zone = zoneIdentityModel createVPCRouteOptionsModel.Action = core.StringPtr("deliver") + createVPCRouteOptionsModel.Advertise = core.BoolPtr(false) createVPCRouteOptionsModel.Name = core.StringPtr("my-route-1") createVPCRouteOptionsModel.NextHop = routePrototypeNextHopModel createVPCRouteOptionsModel.Priority = core.Int64Ptr(int64(1)) @@ -5457,7 +5458,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", "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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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", "priority": 1, "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", "advertise": false, "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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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", "priority": 1, "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() { @@ -5484,6 +5485,7 @@ var _ = Describe(`VpcV1`, func() { createVPCRouteOptionsModel.Destination = core.StringPtr("192.168.3.0/24") createVPCRouteOptionsModel.Zone = zoneIdentityModel createVPCRouteOptionsModel.Action = core.StringPtr("deliver") + createVPCRouteOptionsModel.Advertise = core.BoolPtr(false) createVPCRouteOptionsModel.Name = core.StringPtr("my-route-1") createVPCRouteOptionsModel.NextHop = routePrototypeNextHopModel createVPCRouteOptionsModel.Priority = core.Int64Ptr(int64(1)) @@ -5544,7 +5546,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", "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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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", "priority": 1, "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", "advertise": false, "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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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", "priority": 1, "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() { @@ -5576,6 +5578,7 @@ var _ = Describe(`VpcV1`, func() { createVPCRouteOptionsModel.Destination = core.StringPtr("192.168.3.0/24") createVPCRouteOptionsModel.Zone = zoneIdentityModel createVPCRouteOptionsModel.Action = core.StringPtr("deliver") + createVPCRouteOptionsModel.Advertise = core.BoolPtr(false) createVPCRouteOptionsModel.Name = core.StringPtr("my-route-1") createVPCRouteOptionsModel.NextHop = routePrototypeNextHopModel createVPCRouteOptionsModel.Priority = core.Int64Ptr(int64(1)) @@ -5611,6 +5614,7 @@ var _ = Describe(`VpcV1`, func() { createVPCRouteOptionsModel.Destination = core.StringPtr("192.168.3.0/24") createVPCRouteOptionsModel.Zone = zoneIdentityModel createVPCRouteOptionsModel.Action = core.StringPtr("deliver") + createVPCRouteOptionsModel.Advertise = core.BoolPtr(false) createVPCRouteOptionsModel.Name = core.StringPtr("my-route-1") createVPCRouteOptionsModel.NextHop = routePrototypeNextHopModel createVPCRouteOptionsModel.Priority = core.Int64Ptr(int64(1)) @@ -5667,6 +5671,7 @@ var _ = Describe(`VpcV1`, func() { createVPCRouteOptionsModel.Destination = core.StringPtr("192.168.3.0/24") createVPCRouteOptionsModel.Zone = zoneIdentityModel createVPCRouteOptionsModel.Action = core.StringPtr("deliver") + createVPCRouteOptionsModel.Advertise = core.BoolPtr(false) createVPCRouteOptionsModel.Name = core.StringPtr("my-route-1") createVPCRouteOptionsModel.NextHop = routePrototypeNextHopModel createVPCRouteOptionsModel.Priority = core.Int64Ptr(int64(1)) @@ -5830,7 +5835,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", "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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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", "priority": 1, "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", "advertise": false, "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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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", "priority": 1, "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() { @@ -5888,7 +5893,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", "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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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", "priority": 1, "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", "advertise": false, "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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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", "priority": 1, "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() { @@ -6023,6 +6028,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the RoutePatch model routePatchModel := new(vpcv1.RoutePatch) + routePatchModel.Advertise = core.BoolPtr(true) routePatchModel.Name = core.StringPtr("my-route-2") routePatchModel.NextHop = routeNextHopPatchModel routePatchModel.Priority = core.Int64Ptr(int64(1)) @@ -6089,7 +6095,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", "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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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", "priority": 1, "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", "advertise": false, "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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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", "priority": 1, "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() { @@ -6108,6 +6114,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the RoutePatch model routePatchModel := new(vpcv1.RoutePatch) + routePatchModel.Advertise = core.BoolPtr(true) routePatchModel.Name = core.StringPtr("my-route-2") routePatchModel.NextHop = routeNextHopPatchModel routePatchModel.Priority = core.Int64Ptr(int64(1)) @@ -6176,7 +6183,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", "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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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", "priority": 1, "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", "advertise": false, "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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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", "priority": 1, "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() { @@ -6200,6 +6207,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the RoutePatch model routePatchModel := new(vpcv1.RoutePatch) + routePatchModel.Advertise = core.BoolPtr(true) routePatchModel.Name = core.StringPtr("my-route-2") routePatchModel.NextHop = routeNextHopPatchModel routePatchModel.Priority = core.Int64Ptr(int64(1)) @@ -6235,6 +6243,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the RoutePatch model routePatchModel := new(vpcv1.RoutePatch) + routePatchModel.Advertise = core.BoolPtr(true) routePatchModel.Name = core.StringPtr("my-route-2") routePatchModel.NextHop = routeNextHopPatchModel routePatchModel.Priority = core.Int64Ptr(int64(1)) @@ -6291,6 +6300,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the RoutePatch model routePatchModel := new(vpcv1.RoutePatch) + routePatchModel.Advertise = core.BoolPtr(true) routePatchModel.Name = core.StringPtr("my-route-2") routePatchModel.NextHop = routeNextHopPatchModel routePatchModel.Priority = core.Int64Ptr(int64(1)) @@ -6395,7 +6405,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": [{"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_internet_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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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"}], "advertise_routes_to": ["transit_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_internet_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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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() { @@ -6458,7 +6468,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": [{"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_internet_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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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"}], "advertise_routes_to": ["transit_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_internet_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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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() { @@ -6609,9 +6619,9 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) requestNumber++ if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"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_internet_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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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":2,"limit":1}`) + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"routing_tables":[{"accept_routes_from":[{"resource_type":"vpn_gateway"}],"advertise_routes_to":["transit_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_internet_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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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":2,"limit":1}`) } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"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_internet_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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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":2,"limit":1}`) + fmt.Fprintf(res, "%s", `{"routing_tables":[{"accept_routes_from":[{"resource_type":"vpn_gateway"}],"advertise_routes_to":["transit_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_internet_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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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":2,"limit":1}`) } else { res.WriteHeader(400) } @@ -6713,6 +6723,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the RoutePrototype model routePrototypeModel := new(vpcv1.RoutePrototype) routePrototypeModel.Action = core.StringPtr("deliver") + routePrototypeModel.Advertise = core.BoolPtr(false) routePrototypeModel.Destination = core.StringPtr("192.168.3.0/24") routePrototypeModel.Name = core.StringPtr("my-route-1") routePrototypeModel.NextHop = routePrototypeNextHopModel @@ -6723,6 +6734,7 @@ var _ = Describe(`VpcV1`, func() { createVPCRoutingTableOptionsModel := new(vpcv1.CreateVPCRoutingTableOptions) createVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") createVPCRoutingTableOptionsModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} + createVPCRoutingTableOptionsModel.AdvertiseRoutesTo = []string{} createVPCRoutingTableOptionsModel.Name = core.StringPtr("my-routing-table-1") createVPCRoutingTableOptionsModel.RouteDirectLinkIngress = core.BoolPtr(false) createVPCRoutingTableOptionsModel.RouteInternetIngress = core.BoolPtr(false) @@ -6784,7 +6796,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - 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_internet_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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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"}], "advertise_routes_to": ["transit_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_internet_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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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() { @@ -6812,6 +6824,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the RoutePrototype model routePrototypeModel := new(vpcv1.RoutePrototype) routePrototypeModel.Action = core.StringPtr("deliver") + routePrototypeModel.Advertise = core.BoolPtr(false) routePrototypeModel.Destination = core.StringPtr("192.168.3.0/24") routePrototypeModel.Name = core.StringPtr("my-route-1") routePrototypeModel.NextHop = routePrototypeNextHopModel @@ -6822,6 +6835,7 @@ var _ = Describe(`VpcV1`, func() { createVPCRoutingTableOptionsModel := new(vpcv1.CreateVPCRoutingTableOptions) createVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") createVPCRoutingTableOptionsModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} + createVPCRoutingTableOptionsModel.AdvertiseRoutesTo = []string{} createVPCRoutingTableOptionsModel.Name = core.StringPtr("my-routing-table-1") createVPCRoutingTableOptionsModel.RouteDirectLinkIngress = core.BoolPtr(false) createVPCRoutingTableOptionsModel.RouteInternetIngress = core.BoolPtr(false) @@ -6885,7 +6899,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - 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_internet_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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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"}], "advertise_routes_to": ["transit_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_internet_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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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() { @@ -6918,6 +6932,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the RoutePrototype model routePrototypeModel := new(vpcv1.RoutePrototype) routePrototypeModel.Action = core.StringPtr("deliver") + routePrototypeModel.Advertise = core.BoolPtr(false) routePrototypeModel.Destination = core.StringPtr("192.168.3.0/24") routePrototypeModel.Name = core.StringPtr("my-route-1") routePrototypeModel.NextHop = routePrototypeNextHopModel @@ -6928,6 +6943,7 @@ var _ = Describe(`VpcV1`, func() { createVPCRoutingTableOptionsModel := new(vpcv1.CreateVPCRoutingTableOptions) createVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") createVPCRoutingTableOptionsModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} + createVPCRoutingTableOptionsModel.AdvertiseRoutesTo = []string{} createVPCRoutingTableOptionsModel.Name = core.StringPtr("my-routing-table-1") createVPCRoutingTableOptionsModel.RouteDirectLinkIngress = core.BoolPtr(false) createVPCRoutingTableOptionsModel.RouteInternetIngress = core.BoolPtr(false) @@ -6967,6 +6983,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the RoutePrototype model routePrototypeModel := new(vpcv1.RoutePrototype) routePrototypeModel.Action = core.StringPtr("deliver") + routePrototypeModel.Advertise = core.BoolPtr(false) routePrototypeModel.Destination = core.StringPtr("192.168.3.0/24") routePrototypeModel.Name = core.StringPtr("my-route-1") routePrototypeModel.NextHop = routePrototypeNextHopModel @@ -6977,6 +6994,7 @@ var _ = Describe(`VpcV1`, func() { createVPCRoutingTableOptionsModel := new(vpcv1.CreateVPCRoutingTableOptions) createVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") createVPCRoutingTableOptionsModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} + createVPCRoutingTableOptionsModel.AdvertiseRoutesTo = []string{} createVPCRoutingTableOptionsModel.Name = core.StringPtr("my-routing-table-1") createVPCRoutingTableOptionsModel.RouteDirectLinkIngress = core.BoolPtr(false) createVPCRoutingTableOptionsModel.RouteInternetIngress = core.BoolPtr(false) @@ -7037,6 +7055,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the RoutePrototype model routePrototypeModel := new(vpcv1.RoutePrototype) routePrototypeModel.Action = core.StringPtr("deliver") + routePrototypeModel.Advertise = core.BoolPtr(false) routePrototypeModel.Destination = core.StringPtr("192.168.3.0/24") routePrototypeModel.Name = core.StringPtr("my-route-1") routePrototypeModel.NextHop = routePrototypeNextHopModel @@ -7047,6 +7066,7 @@ var _ = Describe(`VpcV1`, func() { createVPCRoutingTableOptionsModel := new(vpcv1.CreateVPCRoutingTableOptions) createVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") createVPCRoutingTableOptionsModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} + createVPCRoutingTableOptionsModel.AdvertiseRoutesTo = []string{} createVPCRoutingTableOptionsModel.Name = core.StringPtr("my-routing-table-1") createVPCRoutingTableOptionsModel.RouteDirectLinkIngress = core.BoolPtr(false) createVPCRoutingTableOptionsModel.RouteInternetIngress = core.BoolPtr(false) @@ -7217,7 +7237,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - 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_internet_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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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"}], "advertise_routes_to": ["transit_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_internet_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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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() { @@ -7275,7 +7295,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - 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_internet_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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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"}], "advertise_routes_to": ["transit_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_internet_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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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() { @@ -7413,6 +7433,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the RoutingTablePatch model routingTablePatchModel := new(vpcv1.RoutingTablePatch) routingTablePatchModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} + routingTablePatchModel.AdvertiseRoutesTo = []string{"transit_gateway"} routingTablePatchModel.Name = core.StringPtr("my-routing-table-2") routingTablePatchModel.RouteDirectLinkIngress = core.BoolPtr(true) routingTablePatchModel.RouteInternetIngress = core.BoolPtr(true) @@ -7484,7 +7505,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - 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_internet_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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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"}], "advertise_routes_to": ["transit_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_internet_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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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() { @@ -7504,6 +7525,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the RoutingTablePatch model routingTablePatchModel := new(vpcv1.RoutingTablePatch) routingTablePatchModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} + routingTablePatchModel.AdvertiseRoutesTo = []string{"transit_gateway"} routingTablePatchModel.Name = core.StringPtr("my-routing-table-2") routingTablePatchModel.RouteDirectLinkIngress = core.BoolPtr(true) routingTablePatchModel.RouteInternetIngress = core.BoolPtr(true) @@ -7577,7 +7599,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - 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_internet_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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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"}], "advertise_routes_to": ["transit_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_internet_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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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() { @@ -7602,6 +7624,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the RoutingTablePatch model routingTablePatchModel := new(vpcv1.RoutingTablePatch) routingTablePatchModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} + routingTablePatchModel.AdvertiseRoutesTo = []string{"transit_gateway"} routingTablePatchModel.Name = core.StringPtr("my-routing-table-2") routingTablePatchModel.RouteDirectLinkIngress = core.BoolPtr(true) routingTablePatchModel.RouteInternetIngress = core.BoolPtr(true) @@ -7641,6 +7664,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the RoutingTablePatch model routingTablePatchModel := new(vpcv1.RoutingTablePatch) routingTablePatchModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} + routingTablePatchModel.AdvertiseRoutesTo = []string{"transit_gateway"} routingTablePatchModel.Name = core.StringPtr("my-routing-table-2") routingTablePatchModel.RouteDirectLinkIngress = core.BoolPtr(true) routingTablePatchModel.RouteInternetIngress = core.BoolPtr(true) @@ -7701,6 +7725,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the RoutingTablePatch model routingTablePatchModel := new(vpcv1.RoutingTablePatch) routingTablePatchModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} + routingTablePatchModel.AdvertiseRoutesTo = []string{"transit_gateway"} routingTablePatchModel.Name = core.StringPtr("my-routing-table-2") routingTablePatchModel.RouteDirectLinkIngress = core.BoolPtr(true) routingTablePatchModel.RouteInternetIngress = core.BoolPtr(true) @@ -7806,7 +7831,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", "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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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", "priority": 1, "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", "advertise": false, "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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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", "priority": 1, "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() { @@ -7868,7 +7893,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", "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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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", "priority": 1, "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", "advertise": false, "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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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", "priority": 1, "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() { @@ -8019,9 +8044,9 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) requestNumber++ if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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","priority":1,"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}`) + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"routes":[{"action":"delegate","advertise":false,"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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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","priority":1,"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}`) } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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","priority":1,"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}`) + fmt.Fprintf(res, "%s", `{"routes":[{"action":"delegate","advertise":false,"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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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","priority":1,"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}`) } else { res.WriteHeader(400) } @@ -8123,6 +8148,7 @@ var _ = Describe(`VpcV1`, func() { createVPCRoutingTableRouteOptionsModel.Destination = core.StringPtr("192.168.3.0/24") createVPCRoutingTableRouteOptionsModel.Zone = zoneIdentityModel createVPCRoutingTableRouteOptionsModel.Action = core.StringPtr("deliver") + createVPCRoutingTableRouteOptionsModel.Advertise = core.BoolPtr(false) createVPCRoutingTableRouteOptionsModel.Name = core.StringPtr("my-route-1") createVPCRoutingTableRouteOptionsModel.NextHop = routePrototypeNextHopModel createVPCRoutingTableRouteOptionsModel.Priority = core.Int64Ptr(int64(1)) @@ -8181,7 +8207,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", "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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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", "priority": 1, "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", "advertise": false, "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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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", "priority": 1, "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() { @@ -8209,6 +8235,7 @@ var _ = Describe(`VpcV1`, func() { createVPCRoutingTableRouteOptionsModel.Destination = core.StringPtr("192.168.3.0/24") createVPCRoutingTableRouteOptionsModel.Zone = zoneIdentityModel createVPCRoutingTableRouteOptionsModel.Action = core.StringPtr("deliver") + createVPCRoutingTableRouteOptionsModel.Advertise = core.BoolPtr(false) createVPCRoutingTableRouteOptionsModel.Name = core.StringPtr("my-route-1") createVPCRoutingTableRouteOptionsModel.NextHop = routePrototypeNextHopModel createVPCRoutingTableRouteOptionsModel.Priority = core.Int64Ptr(int64(1)) @@ -8269,7 +8296,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", "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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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", "priority": 1, "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", "advertise": false, "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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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", "priority": 1, "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() { @@ -8302,6 +8329,7 @@ var _ = Describe(`VpcV1`, func() { createVPCRoutingTableRouteOptionsModel.Destination = core.StringPtr("192.168.3.0/24") createVPCRoutingTableRouteOptionsModel.Zone = zoneIdentityModel createVPCRoutingTableRouteOptionsModel.Action = core.StringPtr("deliver") + createVPCRoutingTableRouteOptionsModel.Advertise = core.BoolPtr(false) createVPCRoutingTableRouteOptionsModel.Name = core.StringPtr("my-route-1") createVPCRoutingTableRouteOptionsModel.NextHop = routePrototypeNextHopModel createVPCRoutingTableRouteOptionsModel.Priority = core.Int64Ptr(int64(1)) @@ -8338,6 +8366,7 @@ var _ = Describe(`VpcV1`, func() { createVPCRoutingTableRouteOptionsModel.Destination = core.StringPtr("192.168.3.0/24") createVPCRoutingTableRouteOptionsModel.Zone = zoneIdentityModel createVPCRoutingTableRouteOptionsModel.Action = core.StringPtr("deliver") + createVPCRoutingTableRouteOptionsModel.Advertise = core.BoolPtr(false) createVPCRoutingTableRouteOptionsModel.Name = core.StringPtr("my-route-1") createVPCRoutingTableRouteOptionsModel.NextHop = routePrototypeNextHopModel createVPCRoutingTableRouteOptionsModel.Priority = core.Int64Ptr(int64(1)) @@ -8395,6 +8424,7 @@ var _ = Describe(`VpcV1`, func() { createVPCRoutingTableRouteOptionsModel.Destination = core.StringPtr("192.168.3.0/24") createVPCRoutingTableRouteOptionsModel.Zone = zoneIdentityModel createVPCRoutingTableRouteOptionsModel.Action = core.StringPtr("deliver") + createVPCRoutingTableRouteOptionsModel.Advertise = core.BoolPtr(false) createVPCRoutingTableRouteOptionsModel.Name = core.StringPtr("my-route-1") createVPCRoutingTableRouteOptionsModel.NextHop = routePrototypeNextHopModel createVPCRoutingTableRouteOptionsModel.Priority = core.Int64Ptr(int64(1)) @@ -8561,7 +8591,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", "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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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", "priority": 1, "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", "advertise": false, "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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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", "priority": 1, "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() { @@ -8620,7 +8650,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", "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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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", "priority": 1, "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", "advertise": false, "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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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", "priority": 1, "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() { @@ -8758,6 +8788,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the RoutePatch model routePatchModel := new(vpcv1.RoutePatch) + routePatchModel.Advertise = core.BoolPtr(true) routePatchModel.Name = core.StringPtr("my-route-2") routePatchModel.NextHop = routeNextHopPatchModel routePatchModel.Priority = core.Int64Ptr(int64(1)) @@ -8825,7 +8856,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", "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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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", "priority": 1, "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", "advertise": false, "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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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", "priority": 1, "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() { @@ -8844,6 +8875,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the RoutePatch model routePatchModel := new(vpcv1.RoutePatch) + routePatchModel.Advertise = core.BoolPtr(true) routePatchModel.Name = core.StringPtr("my-route-2") routePatchModel.NextHop = routeNextHopPatchModel routePatchModel.Priority = core.Int64Ptr(int64(1)) @@ -8913,7 +8945,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", "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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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", "priority": 1, "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", "advertise": false, "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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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", "priority": 1, "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() { @@ -8937,6 +8969,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the RoutePatch model routePatchModel := new(vpcv1.RoutePatch) + routePatchModel.Advertise = core.BoolPtr(true) routePatchModel.Name = core.StringPtr("my-route-2") routePatchModel.NextHop = routeNextHopPatchModel routePatchModel.Priority = core.Int64Ptr(int64(1)) @@ -8973,6 +9006,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the RoutePatch model routePatchModel := new(vpcv1.RoutePatch) + routePatchModel.Advertise = core.BoolPtr(true) routePatchModel.Name = core.StringPtr("my-route-2") routePatchModel.NextHop = routeNextHopPatchModel routePatchModel.Priority = core.Int64Ptr(int64(1)) @@ -9030,6 +9064,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the RoutePatch model routePatchModel := new(vpcv1.RoutePatch) + routePatchModel.Advertise = core.BoolPtr(true) routePatchModel.Name = core.StringPtr("my-route-2") routePatchModel.NextHop = routeNextHopPatchModel routePatchModel.Priority = core.Int64Ptr(int64(1)) @@ -11715,7 +11750,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - 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_internet_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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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"}], "advertise_routes_to": ["transit_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_internet_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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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() { @@ -11772,7 +11807,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - 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_internet_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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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"}], "advertise_routes_to": ["transit_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_internet_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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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() { @@ -11961,7 +11996,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - 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_internet_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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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"}], "advertise_routes_to": ["transit_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_internet_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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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() { @@ -12039,7 +12074,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - 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_internet_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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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"}], "advertise_routes_to": ["transit_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_internet_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/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840/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() { @@ -12169,6 +12204,10 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) + Expect(req.URL.Query()["target.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["target.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727"})) + Expect(req.URL.Query()["target.name"]).To(Equal([]string{"my-resource"})) + Expect(req.URL.Query()["target.resource_type"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) @@ -12189,6 +12228,10 @@ var _ = Describe(`VpcV1`, func() { listSubnetReservedIpsOptionsModel.Start = core.StringPtr("testString") listSubnetReservedIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) listSubnetReservedIpsOptionsModel.Sort = core.StringPtr("name") + listSubnetReservedIpsOptionsModel.TargetID = core.StringPtr("testString") + listSubnetReservedIpsOptionsModel.TargetCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727") + listSubnetReservedIpsOptionsModel.TargetName = core.StringPtr("my-resource") + listSubnetReservedIpsOptionsModel.TargetResourceType = core.StringPtr("testString") listSubnetReservedIpsOptionsModel.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.ListSubnetReservedIps(listSubnetReservedIpsOptionsModel) @@ -12225,6 +12268,10 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) + Expect(req.URL.Query()["target.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["target.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727"})) + Expect(req.URL.Query()["target.name"]).To(Equal([]string{"my-resource"})) + Expect(req.URL.Query()["target.resource_type"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) @@ -12250,6 +12297,10 @@ var _ = Describe(`VpcV1`, func() { listSubnetReservedIpsOptionsModel.Start = core.StringPtr("testString") listSubnetReservedIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) listSubnetReservedIpsOptionsModel.Sort = core.StringPtr("name") + listSubnetReservedIpsOptionsModel.TargetID = core.StringPtr("testString") + listSubnetReservedIpsOptionsModel.TargetCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727") + listSubnetReservedIpsOptionsModel.TargetName = core.StringPtr("my-resource") + listSubnetReservedIpsOptionsModel.TargetResourceType = core.StringPtr("testString") listSubnetReservedIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error @@ -12291,6 +12342,10 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) + Expect(req.URL.Query()["target.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["target.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727"})) + Expect(req.URL.Query()["target.name"]).To(Equal([]string{"my-resource"})) + Expect(req.URL.Query()["target.resource_type"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) @@ -12318,6 +12373,10 @@ var _ = Describe(`VpcV1`, func() { listSubnetReservedIpsOptionsModel.Start = core.StringPtr("testString") listSubnetReservedIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) listSubnetReservedIpsOptionsModel.Sort = core.StringPtr("name") + listSubnetReservedIpsOptionsModel.TargetID = core.StringPtr("testString") + listSubnetReservedIpsOptionsModel.TargetCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727") + listSubnetReservedIpsOptionsModel.TargetName = core.StringPtr("my-resource") + listSubnetReservedIpsOptionsModel.TargetResourceType = core.StringPtr("testString") listSubnetReservedIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) @@ -12342,6 +12401,10 @@ var _ = Describe(`VpcV1`, func() { listSubnetReservedIpsOptionsModel.Start = core.StringPtr("testString") listSubnetReservedIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) listSubnetReservedIpsOptionsModel.Sort = core.StringPtr("name") + listSubnetReservedIpsOptionsModel.TargetID = core.StringPtr("testString") + listSubnetReservedIpsOptionsModel.TargetCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727") + listSubnetReservedIpsOptionsModel.TargetName = core.StringPtr("my-resource") + listSubnetReservedIpsOptionsModel.TargetResourceType = core.StringPtr("testString") listSubnetReservedIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") @@ -12387,6 +12450,10 @@ var _ = Describe(`VpcV1`, func() { listSubnetReservedIpsOptionsModel.Start = core.StringPtr("testString") listSubnetReservedIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) listSubnetReservedIpsOptionsModel.Sort = core.StringPtr("name") + listSubnetReservedIpsOptionsModel.TargetID = core.StringPtr("testString") + listSubnetReservedIpsOptionsModel.TargetCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727") + listSubnetReservedIpsOptionsModel.TargetName = core.StringPtr("my-resource") + listSubnetReservedIpsOptionsModel.TargetResourceType = core.StringPtr("testString") listSubnetReservedIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation @@ -12463,9 +12530,13 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) listSubnetReservedIpsOptionsModel := &vpcv1.ListSubnetReservedIpsOptions{ - SubnetID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - Sort: core.StringPtr("name"), + SubnetID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Sort: core.StringPtr("name"), + TargetID: core.StringPtr("testString"), + TargetCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727"), + TargetName: core.StringPtr("my-resource"), + TargetResourceType: core.StringPtr("testString"), } pager, err := vpcService.NewSubnetReservedIpsPager(listSubnetReservedIpsOptionsModel) @@ -12491,9 +12562,13 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) listSubnetReservedIpsOptionsModel := &vpcv1.ListSubnetReservedIpsOptions{ - SubnetID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - Sort: core.StringPtr("name"), + SubnetID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Sort: core.StringPtr("name"), + TargetID: core.StringPtr("testString"), + TargetCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727"), + TargetName: core.StringPtr("my-resource"), + TargetResourceType: core.StringPtr("testString"), } pager, err := vpcService.NewSubnetReservedIpsPager(listSubnetReservedIpsOptionsModel) @@ -17878,7 +17953,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"profiles": [{"bandwidth": {"type": "fixed", "value": 20000}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "nvme", "type": "enum", "values": ["nvme"]}}], "family": "balanced", "gpu_count": {"type": "fixed", "value": 2}, "gpu_manufacturer": {"type": "enum", "values": ["nvidia"]}, "gpu_memory": {"type": "fixed", "value": 16}, "gpu_model": {"type": "enum", "values": ["Tesla V100"]}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "memory": {"type": "fixed", "value": 16}, "name": "bx2-4x16", "network_interface_count": {"max": 5, "min": 1, "type": "range"}, "numa_count": {"type": "fixed", "value": 2}, "os_architecture": {"default": "Default", "type": "enum", "values": ["amd64"]}, "port_speed": {"type": "fixed", "value": 1000}, "status": "current", "total_volume_bandwidth": {"type": "fixed", "value": 20000}, "vcpu_architecture": {"default": "Default", "type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"default": "Default", "type": "fixed", "value": "intel"}}]}`) + fmt.Fprintf(res, "%s", `{"profiles": [{"bandwidth": {"type": "fixed", "value": 20000}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "nvme", "type": "enum", "values": ["nvme"]}}], "family": "balanced", "gpu_count": {"type": "fixed", "value": 2}, "gpu_manufacturer": {"type": "enum", "values": ["nvidia"]}, "gpu_memory": {"type": "fixed", "value": 16}, "gpu_model": {"type": "enum", "values": ["Tesla V100"]}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "memory": {"type": "fixed", "value": 16}, "name": "bx2-4x16", "network_attachment_count": {"max": 5, "min": 1, "type": "range"}, "network_interface_count": {"max": 5, "min": 1, "type": "range"}, "numa_count": {"type": "fixed", "value": 2}, "os_architecture": {"default": "Default", "type": "enum", "values": ["amd64"]}, "port_speed": {"type": "fixed", "value": 1000}, "status": "current", "total_volume_bandwidth": {"type": "fixed", "value": 20000}, "vcpu_architecture": {"default": "Default", "type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"default": "Default", "type": "fixed", "value": "intel"}}]}`) })) }) It(`Invoke ListInstanceProfiles successfully with retries`, func() { @@ -17934,7 +18009,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"profiles": [{"bandwidth": {"type": "fixed", "value": 20000}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "nvme", "type": "enum", "values": ["nvme"]}}], "family": "balanced", "gpu_count": {"type": "fixed", "value": 2}, "gpu_manufacturer": {"type": "enum", "values": ["nvidia"]}, "gpu_memory": {"type": "fixed", "value": 16}, "gpu_model": {"type": "enum", "values": ["Tesla V100"]}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "memory": {"type": "fixed", "value": 16}, "name": "bx2-4x16", "network_interface_count": {"max": 5, "min": 1, "type": "range"}, "numa_count": {"type": "fixed", "value": 2}, "os_architecture": {"default": "Default", "type": "enum", "values": ["amd64"]}, "port_speed": {"type": "fixed", "value": 1000}, "status": "current", "total_volume_bandwidth": {"type": "fixed", "value": 20000}, "vcpu_architecture": {"default": "Default", "type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"default": "Default", "type": "fixed", "value": "intel"}}]}`) + fmt.Fprintf(res, "%s", `{"profiles": [{"bandwidth": {"type": "fixed", "value": 20000}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "nvme", "type": "enum", "values": ["nvme"]}}], "family": "balanced", "gpu_count": {"type": "fixed", "value": 2}, "gpu_manufacturer": {"type": "enum", "values": ["nvidia"]}, "gpu_memory": {"type": "fixed", "value": 16}, "gpu_model": {"type": "enum", "values": ["Tesla V100"]}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "memory": {"type": "fixed", "value": 16}, "name": "bx2-4x16", "network_attachment_count": {"max": 5, "min": 1, "type": "range"}, "network_interface_count": {"max": 5, "min": 1, "type": "range"}, "numa_count": {"type": "fixed", "value": 2}, "os_architecture": {"default": "Default", "type": "enum", "values": ["amd64"]}, "port_speed": {"type": "fixed", "value": 1000}, "status": "current", "total_volume_bandwidth": {"type": "fixed", "value": 20000}, "vcpu_architecture": {"default": "Default", "type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"default": "Default", "type": "fixed", "value": "intel"}}]}`) })) }) It(`Invoke ListInstanceProfiles successfully`, func() { @@ -18092,7 +18167,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"bandwidth": {"type": "fixed", "value": 20000}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "nvme", "type": "enum", "values": ["nvme"]}}], "family": "balanced", "gpu_count": {"type": "fixed", "value": 2}, "gpu_manufacturer": {"type": "enum", "values": ["nvidia"]}, "gpu_memory": {"type": "fixed", "value": 16}, "gpu_model": {"type": "enum", "values": ["Tesla V100"]}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "memory": {"type": "fixed", "value": 16}, "name": "bx2-4x16", "network_interface_count": {"max": 5, "min": 1, "type": "range"}, "numa_count": {"type": "fixed", "value": 2}, "os_architecture": {"default": "Default", "type": "enum", "values": ["amd64"]}, "port_speed": {"type": "fixed", "value": 1000}, "status": "current", "total_volume_bandwidth": {"type": "fixed", "value": 20000}, "vcpu_architecture": {"default": "Default", "type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"default": "Default", "type": "fixed", "value": "intel"}}`) + fmt.Fprintf(res, "%s", `{"bandwidth": {"type": "fixed", "value": 20000}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "nvme", "type": "enum", "values": ["nvme"]}}], "family": "balanced", "gpu_count": {"type": "fixed", "value": 2}, "gpu_manufacturer": {"type": "enum", "values": ["nvidia"]}, "gpu_memory": {"type": "fixed", "value": 16}, "gpu_model": {"type": "enum", "values": ["Tesla V100"]}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "memory": {"type": "fixed", "value": 16}, "name": "bx2-4x16", "network_attachment_count": {"max": 5, "min": 1, "type": "range"}, "network_interface_count": {"max": 5, "min": 1, "type": "range"}, "numa_count": {"type": "fixed", "value": 2}, "os_architecture": {"default": "Default", "type": "enum", "values": ["amd64"]}, "port_speed": {"type": "fixed", "value": 1000}, "status": "current", "total_volume_bandwidth": {"type": "fixed", "value": 20000}, "vcpu_architecture": {"default": "Default", "type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"default": "Default", "type": "fixed", "value": "intel"}}`) })) }) It(`Invoke GetInstanceProfile successfully with retries`, func() { @@ -18149,7 +18224,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"bandwidth": {"type": "fixed", "value": 20000}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "nvme", "type": "enum", "values": ["nvme"]}}], "family": "balanced", "gpu_count": {"type": "fixed", "value": 2}, "gpu_manufacturer": {"type": "enum", "values": ["nvidia"]}, "gpu_memory": {"type": "fixed", "value": 16}, "gpu_model": {"type": "enum", "values": ["Tesla V100"]}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "memory": {"type": "fixed", "value": 16}, "name": "bx2-4x16", "network_interface_count": {"max": 5, "min": 1, "type": "range"}, "numa_count": {"type": "fixed", "value": 2}, "os_architecture": {"default": "Default", "type": "enum", "values": ["amd64"]}, "port_speed": {"type": "fixed", "value": 1000}, "status": "current", "total_volume_bandwidth": {"type": "fixed", "value": 20000}, "vcpu_architecture": {"default": "Default", "type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"default": "Default", "type": "fixed", "value": "intel"}}`) + fmt.Fprintf(res, "%s", `{"bandwidth": {"type": "fixed", "value": 20000}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "nvme", "type": "enum", "values": ["nvme"]}}], "family": "balanced", "gpu_count": {"type": "fixed", "value": 2}, "gpu_manufacturer": {"type": "enum", "values": ["nvidia"]}, "gpu_memory": {"type": "fixed", "value": 16}, "gpu_model": {"type": "enum", "values": ["Tesla V100"]}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "memory": {"type": "fixed", "value": 16}, "name": "bx2-4x16", "network_attachment_count": {"max": 5, "min": 1, "type": "range"}, "network_interface_count": {"max": 5, "min": 1, "type": "range"}, "numa_count": {"type": "fixed", "value": 2}, "os_architecture": {"default": "Default", "type": "enum", "values": ["amd64"]}, "port_speed": {"type": "fixed", "value": 1000}, "status": "current", "total_volume_bandwidth": {"type": "fixed", "value": 20000}, "vcpu_architecture": {"default": "Default", "type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"default": "Default", "type": "fixed", "value": "intel"}}`) })) }) It(`Invoke GetInstanceProfile successfully`, func() { @@ -18316,7 +18391,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/instance/templates?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "templates": [{"availability_policy": {"host_failure": "restart"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "UserData", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-instance-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-instance-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "templates": [{"availability_policy": {"host_failure": "restart"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "UserData", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-instance-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-instance-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}, "network_attachments": [{"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}], "primary_network_attachment": {"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}}], "total_count": 132}`) })) }) It(`Invoke ListInstanceTemplates successfully with retries`, func() { @@ -18372,7 +18447,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/instance/templates?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "templates": [{"availability_policy": {"host_failure": "restart"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "UserData", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-instance-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-instance-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "templates": [{"availability_policy": {"host_failure": "restart"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "UserData", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-instance-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-instance-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}, "network_attachments": [{"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}], "primary_network_attachment": {"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}}], "total_count": 132}`) })) }) It(`Invoke ListInstanceTemplates successfully`, func() { @@ -18591,8 +18666,37 @@ var _ = Describe(`VpcV1`, func() { zoneIdentityModel := new(vpcv1.ZoneIdentityByName) zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Construct an instance of the InstanceTemplatePrototypeInstanceTemplateByImage model - instanceTemplatePrototypeModel := new(vpcv1.InstanceTemplatePrototypeInstanceTemplateByImage) + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext model + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + + // Construct an instance of the InstanceNetworkAttachmentPrototype model + instanceNetworkAttachmentPrototypeModel := new(vpcv1.InstanceNetworkAttachmentPrototype) + instanceNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-instance-network-attachment") + instanceNetworkAttachmentPrototypeModel.VirtualNetworkInterface = instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + + // Construct an instance of the InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment model + instanceTemplatePrototypeModel := new(vpcv1.InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment) instanceTemplatePrototypeModel.AvailabilityPolicy = instanceAvailabilityPolicyPrototypeModel instanceTemplatePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel instanceTemplatePrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} @@ -18610,6 +18714,8 @@ var _ = Describe(`VpcV1`, func() { instanceTemplatePrototypeModel.NetworkInterfaces = []vpcv1.NetworkInterfacePrototype{*networkInterfacePrototypeModel} instanceTemplatePrototypeModel.PrimaryNetworkInterface = networkInterfacePrototypeModel instanceTemplatePrototypeModel.Zone = zoneIdentityModel + instanceTemplatePrototypeModel.NetworkAttachments = []vpcv1.InstanceNetworkAttachmentPrototype{*instanceNetworkAttachmentPrototypeModel} + instanceTemplatePrototypeModel.PrimaryNetworkAttachment = instanceNetworkAttachmentPrototypeModel // Construct an instance of the CreateInstanceTemplateOptions model createInstanceTemplateOptionsModel := new(vpcv1.CreateInstanceTemplateOptions) @@ -18669,7 +18775,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "UserData", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-instance-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-instance-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "UserData", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-instance-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-instance-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}, "network_attachments": [{"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}], "primary_network_attachment": {"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}}`) })) }) It(`Invoke CreateInstanceTemplate successfully with retries`, func() { @@ -18785,8 +18891,37 @@ var _ = Describe(`VpcV1`, func() { zoneIdentityModel := new(vpcv1.ZoneIdentityByName) zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Construct an instance of the InstanceTemplatePrototypeInstanceTemplateByImage model - instanceTemplatePrototypeModel := new(vpcv1.InstanceTemplatePrototypeInstanceTemplateByImage) + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext model + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + + // Construct an instance of the InstanceNetworkAttachmentPrototype model + instanceNetworkAttachmentPrototypeModel := new(vpcv1.InstanceNetworkAttachmentPrototype) + instanceNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-instance-network-attachment") + instanceNetworkAttachmentPrototypeModel.VirtualNetworkInterface = instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + + // Construct an instance of the InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment model + instanceTemplatePrototypeModel := new(vpcv1.InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment) instanceTemplatePrototypeModel.AvailabilityPolicy = instanceAvailabilityPolicyPrototypeModel instanceTemplatePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel instanceTemplatePrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} @@ -18804,6 +18939,8 @@ var _ = Describe(`VpcV1`, func() { instanceTemplatePrototypeModel.NetworkInterfaces = []vpcv1.NetworkInterfacePrototype{*networkInterfacePrototypeModel} instanceTemplatePrototypeModel.PrimaryNetworkInterface = networkInterfacePrototypeModel instanceTemplatePrototypeModel.Zone = zoneIdentityModel + instanceTemplatePrototypeModel.NetworkAttachments = []vpcv1.InstanceNetworkAttachmentPrototype{*instanceNetworkAttachmentPrototypeModel} + instanceTemplatePrototypeModel.PrimaryNetworkAttachment = instanceNetworkAttachmentPrototypeModel // Construct an instance of the CreateInstanceTemplateOptions model createInstanceTemplateOptionsModel := new(vpcv1.CreateInstanceTemplateOptions) @@ -18865,7 +19002,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "UserData", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-instance-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-instance-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "UserData", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-instance-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-instance-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}, "network_attachments": [{"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}], "primary_network_attachment": {"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}}`) })) }) It(`Invoke CreateInstanceTemplate successfully`, func() { @@ -18986,8 +19123,37 @@ var _ = Describe(`VpcV1`, func() { zoneIdentityModel := new(vpcv1.ZoneIdentityByName) zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Construct an instance of the InstanceTemplatePrototypeInstanceTemplateByImage model - instanceTemplatePrototypeModel := new(vpcv1.InstanceTemplatePrototypeInstanceTemplateByImage) + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext model + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + + // Construct an instance of the InstanceNetworkAttachmentPrototype model + instanceNetworkAttachmentPrototypeModel := new(vpcv1.InstanceNetworkAttachmentPrototype) + instanceNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-instance-network-attachment") + instanceNetworkAttachmentPrototypeModel.VirtualNetworkInterface = instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + + // Construct an instance of the InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment model + instanceTemplatePrototypeModel := new(vpcv1.InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment) instanceTemplatePrototypeModel.AvailabilityPolicy = instanceAvailabilityPolicyPrototypeModel instanceTemplatePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel instanceTemplatePrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} @@ -19005,6 +19171,8 @@ var _ = Describe(`VpcV1`, func() { instanceTemplatePrototypeModel.NetworkInterfaces = []vpcv1.NetworkInterfacePrototype{*networkInterfacePrototypeModel} instanceTemplatePrototypeModel.PrimaryNetworkInterface = networkInterfacePrototypeModel instanceTemplatePrototypeModel.Zone = zoneIdentityModel + instanceTemplatePrototypeModel.NetworkAttachments = []vpcv1.InstanceNetworkAttachmentPrototype{*instanceNetworkAttachmentPrototypeModel} + instanceTemplatePrototypeModel.PrimaryNetworkAttachment = instanceNetworkAttachmentPrototypeModel // Construct an instance of the CreateInstanceTemplateOptions model createInstanceTemplateOptionsModel := new(vpcv1.CreateInstanceTemplateOptions) @@ -19130,8 +19298,37 @@ var _ = Describe(`VpcV1`, func() { zoneIdentityModel := new(vpcv1.ZoneIdentityByName) zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Construct an instance of the InstanceTemplatePrototypeInstanceTemplateByImage model - instanceTemplatePrototypeModel := new(vpcv1.InstanceTemplatePrototypeInstanceTemplateByImage) + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext model + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + + // Construct an instance of the InstanceNetworkAttachmentPrototype model + instanceNetworkAttachmentPrototypeModel := new(vpcv1.InstanceNetworkAttachmentPrototype) + instanceNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-instance-network-attachment") + instanceNetworkAttachmentPrototypeModel.VirtualNetworkInterface = instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + + // Construct an instance of the InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment model + instanceTemplatePrototypeModel := new(vpcv1.InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment) instanceTemplatePrototypeModel.AvailabilityPolicy = instanceAvailabilityPolicyPrototypeModel instanceTemplatePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel instanceTemplatePrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} @@ -19149,6 +19346,8 @@ var _ = Describe(`VpcV1`, func() { instanceTemplatePrototypeModel.NetworkInterfaces = []vpcv1.NetworkInterfacePrototype{*networkInterfacePrototypeModel} instanceTemplatePrototypeModel.PrimaryNetworkInterface = networkInterfacePrototypeModel instanceTemplatePrototypeModel.Zone = zoneIdentityModel + instanceTemplatePrototypeModel.NetworkAttachments = []vpcv1.InstanceNetworkAttachmentPrototype{*instanceNetworkAttachmentPrototypeModel} + instanceTemplatePrototypeModel.PrimaryNetworkAttachment = instanceNetworkAttachmentPrototypeModel // Construct an instance of the CreateInstanceTemplateOptions model createInstanceTemplateOptionsModel := new(vpcv1.CreateInstanceTemplateOptions) @@ -19295,8 +19494,37 @@ var _ = Describe(`VpcV1`, func() { zoneIdentityModel := new(vpcv1.ZoneIdentityByName) zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Construct an instance of the InstanceTemplatePrototypeInstanceTemplateByImage model - instanceTemplatePrototypeModel := new(vpcv1.InstanceTemplatePrototypeInstanceTemplateByImage) + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext model + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + + // Construct an instance of the InstanceNetworkAttachmentPrototype model + instanceNetworkAttachmentPrototypeModel := new(vpcv1.InstanceNetworkAttachmentPrototype) + instanceNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-instance-network-attachment") + instanceNetworkAttachmentPrototypeModel.VirtualNetworkInterface = instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + + // Construct an instance of the InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment model + instanceTemplatePrototypeModel := new(vpcv1.InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment) instanceTemplatePrototypeModel.AvailabilityPolicy = instanceAvailabilityPolicyPrototypeModel instanceTemplatePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel instanceTemplatePrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} @@ -19314,6 +19542,8 @@ var _ = Describe(`VpcV1`, func() { instanceTemplatePrototypeModel.NetworkInterfaces = []vpcv1.NetworkInterfacePrototype{*networkInterfacePrototypeModel} instanceTemplatePrototypeModel.PrimaryNetworkInterface = networkInterfacePrototypeModel instanceTemplatePrototypeModel.Zone = zoneIdentityModel + instanceTemplatePrototypeModel.NetworkAttachments = []vpcv1.InstanceNetworkAttachmentPrototype{*instanceNetworkAttachmentPrototypeModel} + instanceTemplatePrototypeModel.PrimaryNetworkAttachment = instanceNetworkAttachmentPrototypeModel // Construct an instance of the CreateInstanceTemplateOptions model createInstanceTemplateOptionsModel := new(vpcv1.CreateInstanceTemplateOptions) @@ -19475,7 +19705,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "UserData", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-instance-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-instance-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "UserData", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-instance-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-instance-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}, "network_attachments": [{"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}], "primary_network_attachment": {"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}}`) })) }) It(`Invoke GetInstanceTemplate successfully with retries`, func() { @@ -19532,7 +19762,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "UserData", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-instance-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-instance-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "UserData", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-instance-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-instance-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}, "network_attachments": [{"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}], "primary_network_attachment": {"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}}`) })) }) It(`Invoke GetInstanceTemplate successfully`, func() { @@ -19723,7 +19953,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "UserData", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-instance-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-instance-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "UserData", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-instance-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-instance-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}, "network_attachments": [{"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}], "primary_network_attachment": {"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}}`) })) }) It(`Invoke UpdateInstanceTemplate successfully with retries`, func() { @@ -19803,7 +20033,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "UserData", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-instance-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-instance-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false, "protocol": "https", "response_hop_limit": 2}, "name": "my-instance-template", "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "total_volume_bandwidth": 500, "user_data": "UserData", "volume_attachments": [{"delete_volume_on_instance_delete": false, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 100, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-instance-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-instance-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}, "network_attachments": [{"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}], "primary_network_attachment": {"name": "my-instance-network-attachment", "virtual_network_interface": {"allow_ip_spoofing": true, "auto_delete": false, "enable_infrastructure_nat": true, "ips": [{"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}], "name": "my-virtual-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "resource_group": {"id": "fee82deba12e4c0fb69c3b09d1f12345"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}}}`) })) }) It(`Invoke UpdateInstanceTemplate successfully`, func() { @@ -20030,7 +20260,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/instances?limit=20"}, "instances": [{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 8, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "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"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances?limit=20"}, "instances": [{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 8, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"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"}, "resource_type": "instance_network_attachment", "subnet": {"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"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"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"}, "resource_type": "instance_network_attachment", "subnet": {"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"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "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"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) })) }) It(`Invoke ListInstances successfully with retries`, func() { @@ -20112,7 +20342,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/instances?limit=20"}, "instances": [{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 8, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "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"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances?limit=20"}, "instances": [{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 8, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"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"}, "resource_type": "instance_network_attachment", "subnet": {"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"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"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"}, "resource_type": "instance_network_attachment", "subnet": {"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"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "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"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) })) }) It(`Invoke ListInstances successfully`, func() { @@ -20283,9 +20513,9 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) requestNumber++ if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"instances":[{"availability_policy":{"host_failure":"restart"},"bandwidth":1000,"boot_volume_attachment":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"device":{"id":"80b3e36e-41f4-40e9-bd56-beae81792a68"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","resource_type":"volume"}},"catalog_offering":{"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/123456:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a","dedicated_host":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-host","resource_type":"dedicated_host"},"disks":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","interface_type":"nvme","name":"my-instance-disk","resource_type":"instance_disk","size":100}],"gpu":{"count":1,"manufacturer":"nvidia","memory":1,"model":"Tesla V100"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","image":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"aa2432b1fa4d4ace891e9b80fc104e34","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","memory":8,"metadata_service":{"enabled":false,"protocol":"http","response_hop_limit":1},"name":"my-instance","network_interfaces":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-instance-network-interface","primary_ip":{"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"},"resource_type":"network_interface","subnet":{"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"}}],"numa_count":2,"placement_target":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-host-group","resource_type":"dedicated_host_group"},"primary_network_interface":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-instance-network-interface","primary_ip":{"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"},"resource_type":"network_interface","subnet":{"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"}},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"instance","startable":false,"status":"deleting","status_reasons":[{"code":"cannot_start_storage","message":"The virtual server instance is unusable because the encryption key for the boot volume\\nhas been deleted","more_info":"https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}],"total_network_bandwidth":500,"total_volume_bandwidth":500,"vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"volume_attachments":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"device":{"id":"80b3e36e-41f4-40e9-bd56-beae81792a68"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","resource_type":"volume"}}],"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"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}`) + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"instances":[{"availability_policy":{"host_failure":"restart"},"bandwidth":1000,"boot_volume_attachment":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"device":{"id":"80b3e36e-41f4-40e9-bd56-beae81792a68"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","resource_type":"volume"}},"catalog_offering":{"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/123456:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a","dedicated_host":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-host","resource_type":"dedicated_host"},"disks":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","interface_type":"nvme","name":"my-instance-disk","resource_type":"instance_disk","size":100}],"gpu":{"count":1,"manufacturer":"nvidia","memory":1,"model":"Tesla V100"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","image":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"aa2432b1fa4d4ace891e9b80fc104e34","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","memory":8,"metadata_service":{"enabled":false,"protocol":"http","response_hop_limit":1},"name":"my-instance","network_attachments":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0767-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0767-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-attachment","primary_ip":{"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"},"resource_type":"instance_network_attachment","subnet":{"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"}}],"network_interfaces":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-instance-network-interface","primary_ip":{"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"},"resource_type":"network_interface","subnet":{"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"}}],"numa_count":2,"placement_target":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-host-group","resource_type":"dedicated_host_group"},"primary_network_attachment":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0767-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0767-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-attachment","primary_ip":{"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"},"resource_type":"instance_network_attachment","subnet":{"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"}},"primary_network_interface":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-instance-network-interface","primary_ip":{"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"},"resource_type":"network_interface","subnet":{"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"}},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"instance","startable":false,"status":"deleting","status_reasons":[{"code":"cannot_start_storage","message":"The virtual server instance is unusable because the encryption key for the boot volume\\nhas been deleted","more_info":"https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}],"total_network_bandwidth":500,"total_volume_bandwidth":500,"vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"volume_attachments":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"device":{"id":"80b3e36e-41f4-40e9-bd56-beae81792a68"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","resource_type":"volume"}}],"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"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}`) } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"instances":[{"availability_policy":{"host_failure":"restart"},"bandwidth":1000,"boot_volume_attachment":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"device":{"id":"80b3e36e-41f4-40e9-bd56-beae81792a68"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","resource_type":"volume"}},"catalog_offering":{"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/123456:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a","dedicated_host":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-host","resource_type":"dedicated_host"},"disks":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","interface_type":"nvme","name":"my-instance-disk","resource_type":"instance_disk","size":100}],"gpu":{"count":1,"manufacturer":"nvidia","memory":1,"model":"Tesla V100"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","image":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"aa2432b1fa4d4ace891e9b80fc104e34","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","memory":8,"metadata_service":{"enabled":false,"protocol":"http","response_hop_limit":1},"name":"my-instance","network_interfaces":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-instance-network-interface","primary_ip":{"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"},"resource_type":"network_interface","subnet":{"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"}}],"numa_count":2,"placement_target":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-host-group","resource_type":"dedicated_host_group"},"primary_network_interface":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-instance-network-interface","primary_ip":{"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"},"resource_type":"network_interface","subnet":{"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"}},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"instance","startable":false,"status":"deleting","status_reasons":[{"code":"cannot_start_storage","message":"The virtual server instance is unusable because the encryption key for the boot volume\\nhas been deleted","more_info":"https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}],"total_network_bandwidth":500,"total_volume_bandwidth":500,"vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"volume_attachments":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"device":{"id":"80b3e36e-41f4-40e9-bd56-beae81792a68"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","resource_type":"volume"}}],"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"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}`) + fmt.Fprintf(res, "%s", `{"instances":[{"availability_policy":{"host_failure":"restart"},"bandwidth":1000,"boot_volume_attachment":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"device":{"id":"80b3e36e-41f4-40e9-bd56-beae81792a68"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","resource_type":"volume"}},"catalog_offering":{"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/123456:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a","dedicated_host":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-host","resource_type":"dedicated_host"},"disks":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","interface_type":"nvme","name":"my-instance-disk","resource_type":"instance_disk","size":100}],"gpu":{"count":1,"manufacturer":"nvidia","memory":1,"model":"Tesla V100"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","image":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"aa2432b1fa4d4ace891e9b80fc104e34","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","memory":8,"metadata_service":{"enabled":false,"protocol":"http","response_hop_limit":1},"name":"my-instance","network_attachments":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0767-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0767-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-attachment","primary_ip":{"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"},"resource_type":"instance_network_attachment","subnet":{"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"}}],"network_interfaces":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-instance-network-interface","primary_ip":{"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"},"resource_type":"network_interface","subnet":{"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"}}],"numa_count":2,"placement_target":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-host-group","resource_type":"dedicated_host_group"},"primary_network_attachment":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0767-d54eb633-98ea-459d-aa00-6a8e780175a7","id":"0767-d54eb633-98ea-459d-aa00-6a8e780175a7","name":"my-instance-network-attachment","primary_ip":{"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"},"resource_type":"instance_network_attachment","subnet":{"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"}},"primary_network_interface":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-instance-network-interface","primary_ip":{"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"},"resource_type":"network_interface","subnet":{"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"}},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"instance","startable":false,"status":"deleting","status_reasons":[{"code":"cannot_start_storage","message":"The virtual server instance is unusable because the encryption key for the boot volume\\nhas been deleted","more_info":"https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}],"total_network_bandwidth":500,"total_volume_bandwidth":500,"vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"volume_attachments":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"device":{"id":"80b3e36e-41f4-40e9-bd56-beae81792a68"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","resource_type":"volume"}}],"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"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}`) } else { res.WriteHeader(400) } @@ -20499,8 +20729,37 @@ var _ = Describe(`VpcV1`, func() { zoneIdentityModel := new(vpcv1.ZoneIdentityByName) zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Construct an instance of the InstancePrototypeInstanceByImage model - instancePrototypeModel := new(vpcv1.InstancePrototypeInstanceByImage) + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext model + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + + // Construct an instance of the InstanceNetworkAttachmentPrototype model + instanceNetworkAttachmentPrototypeModel := new(vpcv1.InstanceNetworkAttachmentPrototype) + instanceNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-instance-network-attachment") + instanceNetworkAttachmentPrototypeModel.VirtualNetworkInterface = instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + + // Construct an instance of the InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment model + instancePrototypeModel := new(vpcv1.InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment) instancePrototypeModel.AvailabilityPolicy = instanceAvailabilityPolicyPrototypeModel instancePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel instancePrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} @@ -20518,6 +20777,8 @@ var _ = Describe(`VpcV1`, func() { instancePrototypeModel.NetworkInterfaces = []vpcv1.NetworkInterfacePrototype{*networkInterfacePrototypeModel} instancePrototypeModel.PrimaryNetworkInterface = networkInterfacePrototypeModel instancePrototypeModel.Zone = zoneIdentityModel + instancePrototypeModel.NetworkAttachments = []vpcv1.InstanceNetworkAttachmentPrototype{*instanceNetworkAttachmentPrototypeModel} + instancePrototypeModel.PrimaryNetworkAttachment = instanceNetworkAttachmentPrototypeModel // Construct an instance of the CreateInstanceOptions model createInstanceOptionsModel := new(vpcv1.CreateInstanceOptions) @@ -20577,7 +20838,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 8, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "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"}, "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", `{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 8, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"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"}, "resource_type": "instance_network_attachment", "subnet": {"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"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"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"}, "resource_type": "instance_network_attachment", "subnet": {"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"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "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"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) It(`Invoke CreateInstance successfully with retries`, func() { @@ -20699,215 +20960,37 @@ var _ = Describe(`VpcV1`, func() { zoneIdentityModel := new(vpcv1.ZoneIdentityByName) zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Construct an instance of the InstancePrototypeInstanceByImage model - instancePrototypeModel := new(vpcv1.InstancePrototypeInstanceByImage) - instancePrototypeModel.AvailabilityPolicy = instanceAvailabilityPolicyPrototypeModel - instancePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel - instancePrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} - instancePrototypeModel.MetadataService = instanceMetadataServicePrototypeModel - instancePrototypeModel.Name = core.StringPtr("my-instance") - instancePrototypeModel.PlacementTarget = instancePlacementTargetPrototypeModel - instancePrototypeModel.Profile = instanceProfileIdentityModel - instancePrototypeModel.ResourceGroup = resourceGroupIdentityModel - instancePrototypeModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) - instancePrototypeModel.UserData = core.StringPtr("testString") - instancePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototype{*volumeAttachmentPrototypeModel} - instancePrototypeModel.VPC = vpcIdentityModel - instancePrototypeModel.BootVolumeAttachment = volumeAttachmentPrototypeInstanceByImageContextModel - instancePrototypeModel.Image = imageIdentityModel - instancePrototypeModel.NetworkInterfaces = []vpcv1.NetworkInterfacePrototype{*networkInterfacePrototypeModel} - instancePrototypeModel.PrimaryNetworkInterface = networkInterfacePrototypeModel - instancePrototypeModel.Zone = zoneIdentityModel - - // Construct an instance of the CreateInstanceOptions model - createInstanceOptionsModel := new(vpcv1.CreateInstanceOptions) - createInstanceOptionsModel.InstancePrototype = instancePrototypeModel - createInstanceOptionsModel.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.CreateInstanceWithContext(ctx, createInstanceOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateInstance(createInstanceOptionsModel) - 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.CreateInstanceWithContext(ctx, createInstanceOptionsModel) - 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(createInstancePath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - // 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", `{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 8, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "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"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) - })) - }) - It(`Invoke CreateInstance 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.CreateInstance(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the InstanceAvailabilityPolicyPrototype model - instanceAvailabilityPolicyPrototypeModel := new(vpcv1.InstanceAvailabilityPolicyPrototype) - instanceAvailabilityPolicyPrototypeModel.HostFailure = core.StringPtr("restart") - - // Construct an instance of the TrustedProfileIdentityTrustedProfileByID model - trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityTrustedProfileByID) - trustedProfileIdentityModel.ID = core.StringPtr("Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5") - - // Construct an instance of the InstanceDefaultTrustedProfilePrototype model - instanceDefaultTrustedProfilePrototypeModel := new(vpcv1.InstanceDefaultTrustedProfilePrototype) - instanceDefaultTrustedProfilePrototypeModel.AutoLink = core.BoolPtr(false) - instanceDefaultTrustedProfilePrototypeModel.Target = trustedProfileIdentityModel - - // Construct an instance of the KeyIdentityByID model - keyIdentityModel := new(vpcv1.KeyIdentityByID) - keyIdentityModel.ID = core.StringPtr("363f6d70-0000-0001-0000-00000013b96c") - - // Construct an instance of the InstanceMetadataServicePrototype model - instanceMetadataServicePrototypeModel := new(vpcv1.InstanceMetadataServicePrototype) - instanceMetadataServicePrototypeModel.Enabled = core.BoolPtr(false) - instanceMetadataServicePrototypeModel.Protocol = core.StringPtr("https") - instanceMetadataServicePrototypeModel.ResponseHopLimit = core.Int64Ptr(int64(2)) - - // Construct an instance of the InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID model - instancePlacementTargetPrototypeModel := new(vpcv1.InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) - instancePlacementTargetPrototypeModel.ID = core.StringPtr("0787-84e4793a-7cd8-4a7b-b253-818aa19d0512") - - // Construct an instance of the InstanceProfileIdentityByName model - instanceProfileIdentityModel := new(vpcv1.InstanceProfileIdentityByName) - instanceProfileIdentityModel.Name = core.StringPtr("bx2-2x8") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the VolumeProfileIdentityByName model - volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) - volumeProfileIdentityModel.Name = core.StringPtr("5iops-tier") - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:[...]") - - // Construct an instance of the VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity model - volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) - volumeAttachmentPrototypeVolumeModel.Iops = core.Int64Ptr(int64(10000)) - volumeAttachmentPrototypeVolumeModel.Name = core.StringPtr("my-data-volume") - volumeAttachmentPrototypeVolumeModel.Profile = volumeProfileIdentityModel - volumeAttachmentPrototypeVolumeModel.ResourceGroup = resourceGroupIdentityModel - volumeAttachmentPrototypeVolumeModel.UserTags = []string{} - volumeAttachmentPrototypeVolumeModel.Capacity = core.Int64Ptr(int64(1000)) - volumeAttachmentPrototypeVolumeModel.EncryptionKey = encryptionKeyIdentityModel - - // Construct an instance of the VolumeAttachmentPrototype model - volumeAttachmentPrototypeModel := new(vpcv1.VolumeAttachmentPrototype) - volumeAttachmentPrototypeModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) - volumeAttachmentPrototypeModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPrototypeModel.Volume = volumeAttachmentPrototypeVolumeModel - - // Construct an instance of the VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("f0aae929-7047-46d1-92e1-9102b07a7f6f") - - // Construct an instance of the VolumePrototypeInstanceByImageContext model - volumePrototypeInstanceByImageContextModel := new(vpcv1.VolumePrototypeInstanceByImageContext) - volumePrototypeInstanceByImageContextModel.Capacity = core.Int64Ptr(int64(100)) - volumePrototypeInstanceByImageContextModel.EncryptionKey = encryptionKeyIdentityModel - volumePrototypeInstanceByImageContextModel.Iops = core.Int64Ptr(int64(10000)) - volumePrototypeInstanceByImageContextModel.Name = core.StringPtr("my-boot-volume") - volumePrototypeInstanceByImageContextModel.Profile = volumeProfileIdentityModel - volumePrototypeInstanceByImageContextModel.ResourceGroup = resourceGroupIdentityModel - volumePrototypeInstanceByImageContextModel.UserTags = []string{} - - // Construct an instance of the VolumeAttachmentPrototypeInstanceByImageContext model - volumeAttachmentPrototypeInstanceByImageContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceByImageContext) - volumeAttachmentPrototypeInstanceByImageContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) - volumeAttachmentPrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPrototypeInstanceByImageContextModel.Volume = volumePrototypeInstanceByImageContextModel - - // Construct an instance of the ImageIdentityByID model - imageIdentityModel := new(vpcv1.ImageIdentityByID) - imageIdentityModel.ID = core.StringPtr("9aaf3bcb-dcd7-4de7-bb60-24e39ff9d366") - - // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model - networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) - networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // 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 SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the NetworkInterfacePrototype model - networkInterfacePrototypeModel := new(vpcv1.NetworkInterfacePrototype) - networkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - networkInterfacePrototypeModel.Name = core.StringPtr("my-instance-network-interface") - networkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - networkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - networkInterfacePrototypeModel.Subnet = subnetIdentityModel - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - // Construct an instance of the InstancePrototypeInstanceByImage model - instancePrototypeModel := new(vpcv1.InstancePrototypeInstanceByImage) + // Construct an instance of the InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext model + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + + // Construct an instance of the InstanceNetworkAttachmentPrototype model + instanceNetworkAttachmentPrototypeModel := new(vpcv1.InstanceNetworkAttachmentPrototype) + instanceNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-instance-network-attachment") + instanceNetworkAttachmentPrototypeModel.VirtualNetworkInterface = instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + + // Construct an instance of the InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment model + instancePrototypeModel := new(vpcv1.InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment) instancePrototypeModel.AvailabilityPolicy = instanceAvailabilityPolicyPrototypeModel instancePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel instancePrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} @@ -20925,6 +21008,246 @@ var _ = Describe(`VpcV1`, func() { instancePrototypeModel.NetworkInterfaces = []vpcv1.NetworkInterfacePrototype{*networkInterfacePrototypeModel} instancePrototypeModel.PrimaryNetworkInterface = networkInterfacePrototypeModel instancePrototypeModel.Zone = zoneIdentityModel + instancePrototypeModel.NetworkAttachments = []vpcv1.InstanceNetworkAttachmentPrototype{*instanceNetworkAttachmentPrototypeModel} + instancePrototypeModel.PrimaryNetworkAttachment = instanceNetworkAttachmentPrototypeModel + + // Construct an instance of the CreateInstanceOptions model + createInstanceOptionsModel := new(vpcv1.CreateInstanceOptions) + createInstanceOptionsModel.InstancePrototype = instancePrototypeModel + createInstanceOptionsModel.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.CreateInstanceWithContext(ctx, createInstanceOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateInstance(createInstanceOptionsModel) + 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.CreateInstanceWithContext(ctx, createInstanceOptionsModel) + 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(createInstancePath)) + 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", `{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 8, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"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"}, "resource_type": "instance_network_attachment", "subnet": {"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"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"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"}, "resource_type": "instance_network_attachment", "subnet": {"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"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "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"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke CreateInstance 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.CreateInstance(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the InstanceAvailabilityPolicyPrototype model + instanceAvailabilityPolicyPrototypeModel := new(vpcv1.InstanceAvailabilityPolicyPrototype) + instanceAvailabilityPolicyPrototypeModel.HostFailure = core.StringPtr("restart") + + // Construct an instance of the TrustedProfileIdentityTrustedProfileByID model + trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityTrustedProfileByID) + trustedProfileIdentityModel.ID = core.StringPtr("Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5") + + // Construct an instance of the InstanceDefaultTrustedProfilePrototype model + instanceDefaultTrustedProfilePrototypeModel := new(vpcv1.InstanceDefaultTrustedProfilePrototype) + instanceDefaultTrustedProfilePrototypeModel.AutoLink = core.BoolPtr(false) + instanceDefaultTrustedProfilePrototypeModel.Target = trustedProfileIdentityModel + + // Construct an instance of the KeyIdentityByID model + keyIdentityModel := new(vpcv1.KeyIdentityByID) + keyIdentityModel.ID = core.StringPtr("363f6d70-0000-0001-0000-00000013b96c") + + // Construct an instance of the InstanceMetadataServicePrototype model + instanceMetadataServicePrototypeModel := new(vpcv1.InstanceMetadataServicePrototype) + instanceMetadataServicePrototypeModel.Enabled = core.BoolPtr(false) + instanceMetadataServicePrototypeModel.Protocol = core.StringPtr("https") + instanceMetadataServicePrototypeModel.ResponseHopLimit = core.Int64Ptr(int64(2)) + + // Construct an instance of the InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID model + instancePlacementTargetPrototypeModel := new(vpcv1.InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) + instancePlacementTargetPrototypeModel.ID = core.StringPtr("0787-84e4793a-7cd8-4a7b-b253-818aa19d0512") + + // Construct an instance of the InstanceProfileIdentityByName model + instanceProfileIdentityModel := new(vpcv1.InstanceProfileIdentityByName) + instanceProfileIdentityModel.Name = core.StringPtr("bx2-2x8") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the VolumeProfileIdentityByName model + volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) + volumeProfileIdentityModel.Name = core.StringPtr("5iops-tier") + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:[...]") + + // Construct an instance of the VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity model + volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) + volumeAttachmentPrototypeVolumeModel.Iops = core.Int64Ptr(int64(10000)) + volumeAttachmentPrototypeVolumeModel.Name = core.StringPtr("my-data-volume") + volumeAttachmentPrototypeVolumeModel.Profile = volumeProfileIdentityModel + volumeAttachmentPrototypeVolumeModel.ResourceGroup = resourceGroupIdentityModel + volumeAttachmentPrototypeVolumeModel.UserTags = []string{} + volumeAttachmentPrototypeVolumeModel.Capacity = core.Int64Ptr(int64(1000)) + volumeAttachmentPrototypeVolumeModel.EncryptionKey = encryptionKeyIdentityModel + + // Construct an instance of the VolumeAttachmentPrototype model + volumeAttachmentPrototypeModel := new(vpcv1.VolumeAttachmentPrototype) + volumeAttachmentPrototypeModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) + volumeAttachmentPrototypeModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPrototypeModel.Volume = volumeAttachmentPrototypeVolumeModel + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("f0aae929-7047-46d1-92e1-9102b07a7f6f") + + // Construct an instance of the VolumePrototypeInstanceByImageContext model + volumePrototypeInstanceByImageContextModel := new(vpcv1.VolumePrototypeInstanceByImageContext) + volumePrototypeInstanceByImageContextModel.Capacity = core.Int64Ptr(int64(100)) + volumePrototypeInstanceByImageContextModel.EncryptionKey = encryptionKeyIdentityModel + volumePrototypeInstanceByImageContextModel.Iops = core.Int64Ptr(int64(10000)) + volumePrototypeInstanceByImageContextModel.Name = core.StringPtr("my-boot-volume") + volumePrototypeInstanceByImageContextModel.Profile = volumeProfileIdentityModel + volumePrototypeInstanceByImageContextModel.ResourceGroup = resourceGroupIdentityModel + volumePrototypeInstanceByImageContextModel.UserTags = []string{} + + // Construct an instance of the VolumeAttachmentPrototypeInstanceByImageContext model + volumeAttachmentPrototypeInstanceByImageContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceByImageContext) + volumeAttachmentPrototypeInstanceByImageContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) + volumeAttachmentPrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPrototypeInstanceByImageContextModel.Volume = volumePrototypeInstanceByImageContextModel + + // Construct an instance of the ImageIdentityByID model + imageIdentityModel := new(vpcv1.ImageIdentityByID) + imageIdentityModel.ID = core.StringPtr("9aaf3bcb-dcd7-4de7-bb60-24e39ff9d366") + + // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model + networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) + networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // 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 SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the NetworkInterfacePrototype model + networkInterfacePrototypeModel := new(vpcv1.NetworkInterfacePrototype) + networkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + networkInterfacePrototypeModel.Name = core.StringPtr("my-instance-network-interface") + networkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel + networkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + networkInterfacePrototypeModel.Subnet = subnetIdentityModel + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext model + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + + // Construct an instance of the InstanceNetworkAttachmentPrototype model + instanceNetworkAttachmentPrototypeModel := new(vpcv1.InstanceNetworkAttachmentPrototype) + instanceNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-instance-network-attachment") + instanceNetworkAttachmentPrototypeModel.VirtualNetworkInterface = instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + + // Construct an instance of the InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment model + instancePrototypeModel := new(vpcv1.InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment) + instancePrototypeModel.AvailabilityPolicy = instanceAvailabilityPolicyPrototypeModel + instancePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel + instancePrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} + instancePrototypeModel.MetadataService = instanceMetadataServicePrototypeModel + instancePrototypeModel.Name = core.StringPtr("my-instance") + instancePrototypeModel.PlacementTarget = instancePlacementTargetPrototypeModel + instancePrototypeModel.Profile = instanceProfileIdentityModel + instancePrototypeModel.ResourceGroup = resourceGroupIdentityModel + instancePrototypeModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) + instancePrototypeModel.UserData = core.StringPtr("testString") + instancePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototype{*volumeAttachmentPrototypeModel} + instancePrototypeModel.VPC = vpcIdentityModel + instancePrototypeModel.BootVolumeAttachment = volumeAttachmentPrototypeInstanceByImageContextModel + instancePrototypeModel.Image = imageIdentityModel + instancePrototypeModel.NetworkInterfaces = []vpcv1.NetworkInterfacePrototype{*networkInterfacePrototypeModel} + instancePrototypeModel.PrimaryNetworkInterface = networkInterfacePrototypeModel + instancePrototypeModel.Zone = zoneIdentityModel + instancePrototypeModel.NetworkAttachments = []vpcv1.InstanceNetworkAttachmentPrototype{*instanceNetworkAttachmentPrototypeModel} + instancePrototypeModel.PrimaryNetworkAttachment = instanceNetworkAttachmentPrototypeModel // Construct an instance of the CreateInstanceOptions model createInstanceOptionsModel := new(vpcv1.CreateInstanceOptions) @@ -21056,8 +21379,37 @@ var _ = Describe(`VpcV1`, func() { zoneIdentityModel := new(vpcv1.ZoneIdentityByName) zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Construct an instance of the InstancePrototypeInstanceByImage model - instancePrototypeModel := new(vpcv1.InstancePrototypeInstanceByImage) + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext model + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + + // Construct an instance of the InstanceNetworkAttachmentPrototype model + instanceNetworkAttachmentPrototypeModel := new(vpcv1.InstanceNetworkAttachmentPrototype) + instanceNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-instance-network-attachment") + instanceNetworkAttachmentPrototypeModel.VirtualNetworkInterface = instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + + // Construct an instance of the InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment model + instancePrototypeModel := new(vpcv1.InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment) instancePrototypeModel.AvailabilityPolicy = instanceAvailabilityPolicyPrototypeModel instancePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel instancePrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} @@ -21075,6 +21427,8 @@ var _ = Describe(`VpcV1`, func() { instancePrototypeModel.NetworkInterfaces = []vpcv1.NetworkInterfacePrototype{*networkInterfacePrototypeModel} instancePrototypeModel.PrimaryNetworkInterface = networkInterfacePrototypeModel instancePrototypeModel.Zone = zoneIdentityModel + instancePrototypeModel.NetworkAttachments = []vpcv1.InstanceNetworkAttachmentPrototype{*instanceNetworkAttachmentPrototypeModel} + instancePrototypeModel.PrimaryNetworkAttachment = instanceNetworkAttachmentPrototypeModel // Construct an instance of the CreateInstanceOptions model createInstanceOptionsModel := new(vpcv1.CreateInstanceOptions) @@ -21227,8 +21581,37 @@ var _ = Describe(`VpcV1`, func() { zoneIdentityModel := new(vpcv1.ZoneIdentityByName) zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Construct an instance of the InstancePrototypeInstanceByImage model - instancePrototypeModel := new(vpcv1.InstancePrototypeInstanceByImage) + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext model + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + + // Construct an instance of the InstanceNetworkAttachmentPrototype model + instanceNetworkAttachmentPrototypeModel := new(vpcv1.InstanceNetworkAttachmentPrototype) + instanceNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-instance-network-attachment") + instanceNetworkAttachmentPrototypeModel.VirtualNetworkInterface = instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + + // Construct an instance of the InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment model + instancePrototypeModel := new(vpcv1.InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment) instancePrototypeModel.AvailabilityPolicy = instanceAvailabilityPolicyPrototypeModel instancePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel instancePrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} @@ -21246,6 +21629,8 @@ var _ = Describe(`VpcV1`, func() { instancePrototypeModel.NetworkInterfaces = []vpcv1.NetworkInterfacePrototype{*networkInterfacePrototypeModel} instancePrototypeModel.PrimaryNetworkInterface = networkInterfacePrototypeModel instancePrototypeModel.Zone = zoneIdentityModel + instancePrototypeModel.NetworkAttachments = []vpcv1.InstanceNetworkAttachmentPrototype{*instanceNetworkAttachmentPrototypeModel} + instancePrototypeModel.PrimaryNetworkAttachment = instanceNetworkAttachmentPrototypeModel // Construct an instance of the CreateInstanceOptions model createInstanceOptionsModel := new(vpcv1.CreateInstanceOptions) @@ -21407,7 +21792,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 8, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "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"}, "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", `{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 8, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"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"}, "resource_type": "instance_network_attachment", "subnet": {"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"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"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"}, "resource_type": "instance_network_attachment", "subnet": {"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"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "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"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) It(`Invoke GetInstance successfully with retries`, func() { @@ -21464,7 +21849,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 8, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "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"}, "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", `{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 8, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"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"}, "resource_type": "instance_network_attachment", "subnet": {"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"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"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"}, "resource_type": "instance_network_attachment", "subnet": {"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"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "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"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) It(`Invoke GetInstance successfully`, func() { @@ -21678,7 +22063,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 8, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "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"}, "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", `{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 8, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"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"}, "resource_type": "instance_network_attachment", "subnet": {"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"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"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"}, "resource_type": "instance_network_attachment", "subnet": {"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"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "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"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) It(`Invoke UpdateInstance successfully with retries`, func() { @@ -21781,7 +22166,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 8, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "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"}, "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", `{"availability_policy": {"host_failure": "restart"}, "bandwidth": 1000, "boot_volume_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}, "catalog_offering": {"version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}, "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-instance-disk", "resource_type": "instance_disk", "size": 100}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 8, "metadata_service": {"enabled": false, "protocol": "http", "response_hop_limit": 1}, "name": "my-instance", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"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"}, "resource_type": "instance_network_attachment", "subnet": {"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"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}], "numa_count": 2, "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "name": "my-instance-network-attachment", "primary_ip": {"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"}, "resource_type": "instance_network_attachment", "subnet": {"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"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "instance", "startable": false, "status": "deleting", "status_reasons": [{"code": "cannot_start_storage", "message": "The virtual server instance is unusable because the encryption key for the boot volume\nhas been deleted", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "total_network_bandwidth": 500, "total_volume_bandwidth": 500, "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "volume_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}], "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"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) It(`Invoke UpdateInstance successfully`, func() { @@ -23481,16 +23866,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions) - Operation response error`, func() { + Describe(`ListInstanceNetworkAttachments(listInstanceNetworkAttachmentsOptions *ListInstanceNetworkAttachmentsOptions) - Operation response error`, func() { version := "testString" - listInstanceNetworkInterfacesPath := "/instances/testString/network_interfaces" + listInstanceNetworkAttachmentsPath := "/instances/testString/network_attachments" 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(listInstanceNetworkInterfacesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceNetworkAttachmentsPath)) 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))})) @@ -23499,7 +23884,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListInstanceNetworkInterfaces with error: Operation response processing error`, func() { + It(`Invoke ListInstanceNetworkAttachments with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -23508,19 +23893,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceNetworkInterfacesOptions model - listInstanceNetworkInterfacesOptionsModel := new(vpcv1.ListInstanceNetworkInterfacesOptions) - listInstanceNetworkInterfacesOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceNetworkAttachmentsOptions model + listInstanceNetworkAttachmentsOptionsModel := new(vpcv1.ListInstanceNetworkAttachmentsOptions) + listInstanceNetworkAttachmentsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceNetworkAttachmentsOptionsModel.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.ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptionsModel) + result, response, operationErr := vpcService.ListInstanceNetworkAttachments(listInstanceNetworkAttachmentsOptionsModel) 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.ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptionsModel) + result, response, operationErr = vpcService.ListInstanceNetworkAttachments(listInstanceNetworkAttachmentsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -23530,16 +23915,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions)`, func() { + Describe(`ListInstanceNetworkAttachments(listInstanceNetworkAttachmentsOptions *ListInstanceNetworkAttachmentsOptions)`, func() { version := "testString" - listInstanceNetworkInterfacesPath := "/instances/testString/network_interfaces" + listInstanceNetworkAttachmentsPath := "/instances/testString/network_attachments" 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(listInstanceNetworkInterfacesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceNetworkAttachmentsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -23550,10 +23935,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"network_interfaces": [{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "network_interface", "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"}], "status": "available", "subnet": {"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"}, "type": "primary"}]}`) + fmt.Fprintf(res, "%s", `{"network_attachments": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "lifecycle_state": "stable", "name": "my-instance-network-attachment", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "instance_network_attachment", "subnet": {"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"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}]}`) })) }) - It(`Invoke ListInstanceNetworkInterfaces successfully with retries`, func() { + It(`Invoke ListInstanceNetworkAttachments successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -23563,21 +23948,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListInstanceNetworkInterfacesOptions model - listInstanceNetworkInterfacesOptionsModel := new(vpcv1.ListInstanceNetworkInterfacesOptions) - listInstanceNetworkInterfacesOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceNetworkAttachmentsOptions model + listInstanceNetworkAttachmentsOptionsModel := new(vpcv1.ListInstanceNetworkAttachmentsOptions) + listInstanceNetworkAttachmentsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceNetworkAttachmentsOptionsModel.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.ListInstanceNetworkInterfacesWithContext(ctx, listInstanceNetworkInterfacesOptionsModel) + _, _, operationErr := vpcService.ListInstanceNetworkAttachmentsWithContext(ctx, listInstanceNetworkAttachmentsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptionsModel) + result, response, operationErr := vpcService.ListInstanceNetworkAttachments(listInstanceNetworkAttachmentsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -23585,7 +23970,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListInstanceNetworkInterfacesWithContext(ctx, listInstanceNetworkInterfacesOptionsModel) + _, _, operationErr = vpcService.ListInstanceNetworkAttachmentsWithContext(ctx, listInstanceNetworkAttachmentsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -23599,7 +23984,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceNetworkInterfacesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceNetworkAttachmentsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -23607,10 +23992,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"network_interfaces": [{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "network_interface", "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"}], "status": "available", "subnet": {"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"}, "type": "primary"}]}`) + fmt.Fprintf(res, "%s", `{"network_attachments": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "lifecycle_state": "stable", "name": "my-instance-network-attachment", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "instance_network_attachment", "subnet": {"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"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}]}`) })) }) - It(`Invoke ListInstanceNetworkInterfaces successfully`, func() { + It(`Invoke ListInstanceNetworkAttachments successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -23620,24 +24005,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListInstanceNetworkInterfaces(nil) + result, response, operationErr := vpcService.ListInstanceNetworkAttachments(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListInstanceNetworkInterfacesOptions model - listInstanceNetworkInterfacesOptionsModel := new(vpcv1.ListInstanceNetworkInterfacesOptions) - listInstanceNetworkInterfacesOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceNetworkAttachmentsOptions model + listInstanceNetworkAttachmentsOptionsModel := new(vpcv1.ListInstanceNetworkAttachmentsOptions) + listInstanceNetworkAttachmentsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceNetworkAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptionsModel) + result, response, operationErr = vpcService.ListInstanceNetworkAttachments(listInstanceNetworkAttachmentsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListInstanceNetworkInterfaces with error: Operation validation and request error`, func() { + It(`Invoke ListInstanceNetworkAttachments with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -23646,22 +24031,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceNetworkInterfacesOptions model - listInstanceNetworkInterfacesOptionsModel := new(vpcv1.ListInstanceNetworkInterfacesOptions) - listInstanceNetworkInterfacesOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceNetworkAttachmentsOptions model + listInstanceNetworkAttachmentsOptionsModel := new(vpcv1.ListInstanceNetworkAttachmentsOptions) + listInstanceNetworkAttachmentsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceNetworkAttachmentsOptionsModel.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.ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptionsModel) + result, response, operationErr := vpcService.ListInstanceNetworkAttachments(listInstanceNetworkAttachmentsOptionsModel) 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 ListInstanceNetworkInterfacesOptions model with no property values - listInstanceNetworkInterfacesOptionsModelNew := new(vpcv1.ListInstanceNetworkInterfacesOptions) + // Construct a second instance of the ListInstanceNetworkAttachmentsOptions model with no property values + listInstanceNetworkAttachmentsOptionsModelNew := new(vpcv1.ListInstanceNetworkAttachmentsOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptionsModelNew) + result, response, operationErr = vpcService.ListInstanceNetworkAttachments(listInstanceNetworkAttachmentsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -23679,7 +24064,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListInstanceNetworkInterfaces successfully`, func() { + It(`Invoke ListInstanceNetworkAttachments successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -23688,13 +24073,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceNetworkInterfacesOptions model - listInstanceNetworkInterfacesOptionsModel := new(vpcv1.ListInstanceNetworkInterfacesOptions) - listInstanceNetworkInterfacesOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceNetworkAttachmentsOptions model + listInstanceNetworkAttachmentsOptionsModel := new(vpcv1.ListInstanceNetworkAttachmentsOptions) + listInstanceNetworkAttachmentsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceNetworkAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptionsModel) + result, response, operationErr := vpcService.ListInstanceNetworkAttachments(listInstanceNetworkAttachmentsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -23706,16 +24091,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions) - Operation response error`, func() { + Describe(`CreateInstanceNetworkAttachment(createInstanceNetworkAttachmentOptions *CreateInstanceNetworkAttachmentOptions) - Operation response error`, func() { version := "testString" - createInstanceNetworkInterfacePath := "/instances/testString/network_interfaces" + createInstanceNetworkAttachmentPath := "/instances/testString/network_attachments" 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(createInstanceNetworkInterfacePath)) + Expect(req.URL.EscapedPath()).To(Equal(createInstanceNetworkAttachmentPath)) 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))})) @@ -23724,7 +24109,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateInstanceNetworkInterface with error: Operation response processing error`, func() { + It(`Invoke CreateInstanceNetworkAttachment with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -23733,38 +24118,57 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // 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 VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model - networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) - networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.7") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // 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 CreateInstanceNetworkInterfaceOptions model - createInstanceNetworkInterfaceOptionsModel := new(vpcv1.CreateInstanceNetworkInterfaceOptions) - createInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") - createInstanceNetworkInterfaceOptionsModel.Subnet = subnetIdentityModel - createInstanceNetworkInterfaceOptionsModel.AllowIPSpoofing = core.BoolPtr(true) - createInstanceNetworkInterfaceOptionsModel.Name = core.StringPtr("my-instance-network-interface") - createInstanceNetworkInterfaceOptionsModel.PrimaryIP = networkInterfaceIPPrototypeModel - createInstanceNetworkInterfaceOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - createInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // 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 InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext model + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + + // Construct an instance of the CreateInstanceNetworkAttachmentOptions model + createInstanceNetworkAttachmentOptionsModel := new(vpcv1.CreateInstanceNetworkAttachmentOptions) + createInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + createInstanceNetworkAttachmentOptionsModel.VirtualNetworkInterface = instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + createInstanceNetworkAttachmentOptionsModel.Name = core.StringPtr("testString") + createInstanceNetworkAttachmentOptionsModel.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.CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.CreateInstanceNetworkAttachment(createInstanceNetworkAttachmentOptionsModel) 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.CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptionsModel) + result, response, operationErr = vpcService.CreateInstanceNetworkAttachment(createInstanceNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -23774,16 +24178,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions)`, func() { + Describe(`CreateInstanceNetworkAttachment(createInstanceNetworkAttachmentOptions *CreateInstanceNetworkAttachmentOptions)`, func() { version := "testString" - createInstanceNetworkInterfacePath := "/instances/testString/network_interfaces" + createInstanceNetworkAttachmentPath := "/instances/testString/network_attachments" 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(createInstanceNetworkInterfacePath)) + Expect(req.URL.EscapedPath()).To(Equal(createInstanceNetworkAttachmentPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -23810,10 +24214,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "network_interface", "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"}], "status": "available", "subnet": {"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"}, "type": "primary"}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "lifecycle_state": "stable", "name": "my-instance-network-attachment", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "instance_network_attachment", "subnet": {"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"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}`) })) }) - It(`Invoke CreateInstanceNetworkInterface successfully with retries`, func() { + It(`Invoke CreateInstanceNetworkAttachment successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -23823,40 +24227,59 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // 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 VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model - networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) - networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.7") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // 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 CreateInstanceNetworkInterfaceOptions model - createInstanceNetworkInterfaceOptionsModel := new(vpcv1.CreateInstanceNetworkInterfaceOptions) - createInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") - createInstanceNetworkInterfaceOptionsModel.Subnet = subnetIdentityModel - createInstanceNetworkInterfaceOptionsModel.AllowIPSpoofing = core.BoolPtr(true) - createInstanceNetworkInterfaceOptionsModel.Name = core.StringPtr("my-instance-network-interface") - createInstanceNetworkInterfaceOptionsModel.PrimaryIP = networkInterfaceIPPrototypeModel - createInstanceNetworkInterfaceOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - createInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // 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 InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext model + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + + // Construct an instance of the CreateInstanceNetworkAttachmentOptions model + createInstanceNetworkAttachmentOptionsModel := new(vpcv1.CreateInstanceNetworkAttachmentOptions) + createInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + createInstanceNetworkAttachmentOptionsModel.VirtualNetworkInterface = instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + createInstanceNetworkAttachmentOptionsModel.Name = core.StringPtr("testString") + createInstanceNetworkAttachmentOptionsModel.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.CreateInstanceNetworkInterfaceWithContext(ctx, createInstanceNetworkInterfaceOptionsModel) + _, _, operationErr := vpcService.CreateInstanceNetworkAttachmentWithContext(ctx, createInstanceNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.CreateInstanceNetworkAttachment(createInstanceNetworkAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -23864,7 +24287,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreateInstanceNetworkInterfaceWithContext(ctx, createInstanceNetworkInterfaceOptionsModel) + _, _, operationErr = vpcService.CreateInstanceNetworkAttachmentWithContext(ctx, createInstanceNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -23878,7 +24301,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createInstanceNetworkInterfacePath)) + Expect(req.URL.EscapedPath()).To(Equal(createInstanceNetworkAttachmentPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -23902,10 +24325,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "network_interface", "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"}], "status": "available", "subnet": {"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"}, "type": "primary"}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "lifecycle_state": "stable", "name": "my-instance-network-attachment", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "instance_network_attachment", "subnet": {"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"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}`) })) }) - It(`Invoke CreateInstanceNetworkInterface successfully`, func() { + It(`Invoke CreateInstanceNetworkAttachment successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -23915,43 +24338,62 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreateInstanceNetworkInterface(nil) + result, response, operationErr := vpcService.CreateInstanceNetworkAttachment(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // 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 VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model - networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) - networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.7") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // 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 CreateInstanceNetworkInterfaceOptions model - createInstanceNetworkInterfaceOptionsModel := new(vpcv1.CreateInstanceNetworkInterfaceOptions) - createInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") - createInstanceNetworkInterfaceOptionsModel.Subnet = subnetIdentityModel - createInstanceNetworkInterfaceOptionsModel.AllowIPSpoofing = core.BoolPtr(true) - createInstanceNetworkInterfaceOptionsModel.Name = core.StringPtr("my-instance-network-interface") - createInstanceNetworkInterfaceOptionsModel.PrimaryIP = networkInterfaceIPPrototypeModel - createInstanceNetworkInterfaceOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - createInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // 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 InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext model + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + + // Construct an instance of the CreateInstanceNetworkAttachmentOptions model + createInstanceNetworkAttachmentOptionsModel := new(vpcv1.CreateInstanceNetworkAttachmentOptions) + createInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + createInstanceNetworkAttachmentOptionsModel.VirtualNetworkInterface = instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + createInstanceNetworkAttachmentOptionsModel.Name = core.StringPtr("testString") + createInstanceNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptionsModel) + result, response, operationErr = vpcService.CreateInstanceNetworkAttachment(createInstanceNetworkAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateInstanceNetworkInterface with error: Operation validation and request error`, func() { + It(`Invoke CreateInstanceNetworkAttachment with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -23960,41 +24402,60 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // 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 VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model - networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) - networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.7") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // 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 CreateInstanceNetworkInterfaceOptions model - createInstanceNetworkInterfaceOptionsModel := new(vpcv1.CreateInstanceNetworkInterfaceOptions) - createInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") - createInstanceNetworkInterfaceOptionsModel.Subnet = subnetIdentityModel - createInstanceNetworkInterfaceOptionsModel.AllowIPSpoofing = core.BoolPtr(true) - createInstanceNetworkInterfaceOptionsModel.Name = core.StringPtr("my-instance-network-interface") - createInstanceNetworkInterfaceOptionsModel.PrimaryIP = networkInterfaceIPPrototypeModel - createInstanceNetworkInterfaceOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - createInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // 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 InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext model + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + + // Construct an instance of the CreateInstanceNetworkAttachmentOptions model + createInstanceNetworkAttachmentOptionsModel := new(vpcv1.CreateInstanceNetworkAttachmentOptions) + createInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + createInstanceNetworkAttachmentOptionsModel.VirtualNetworkInterface = instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + createInstanceNetworkAttachmentOptionsModel.Name = core.StringPtr("testString") + createInstanceNetworkAttachmentOptionsModel.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.CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.CreateInstanceNetworkAttachment(createInstanceNetworkAttachmentOptionsModel) 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 CreateInstanceNetworkInterfaceOptions model with no property values - createInstanceNetworkInterfaceOptionsModelNew := new(vpcv1.CreateInstanceNetworkInterfaceOptions) + // Construct a second instance of the CreateInstanceNetworkAttachmentOptions model with no property values + createInstanceNetworkAttachmentOptionsModelNew := new(vpcv1.CreateInstanceNetworkAttachmentOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptionsModelNew) + result, response, operationErr = vpcService.CreateInstanceNetworkAttachment(createInstanceNetworkAttachmentOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -24012,7 +24473,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(201) })) }) - It(`Invoke CreateInstanceNetworkInterface successfully`, func() { + It(`Invoke CreateInstanceNetworkAttachment successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -24021,32 +24482,51 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // 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 VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model - networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) - networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.7") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // 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 CreateInstanceNetworkInterfaceOptions model - createInstanceNetworkInterfaceOptionsModel := new(vpcv1.CreateInstanceNetworkInterfaceOptions) - createInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") - createInstanceNetworkInterfaceOptionsModel.Subnet = subnetIdentityModel - createInstanceNetworkInterfaceOptionsModel.AllowIPSpoofing = core.BoolPtr(true) - createInstanceNetworkInterfaceOptionsModel.Name = core.StringPtr("my-instance-network-interface") - createInstanceNetworkInterfaceOptionsModel.PrimaryIP = networkInterfaceIPPrototypeModel - createInstanceNetworkInterfaceOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - createInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // 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 InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext model + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + + // Construct an instance of the CreateInstanceNetworkAttachmentOptions model + createInstanceNetworkAttachmentOptionsModel := new(vpcv1.CreateInstanceNetworkAttachmentOptions) + createInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + createInstanceNetworkAttachmentOptionsModel.VirtualNetworkInterface = instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + createInstanceNetworkAttachmentOptionsModel.Name = core.StringPtr("testString") + createInstanceNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.CreateInstanceNetworkAttachment(createInstanceNetworkAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -24058,24 +24538,24 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteInstanceNetworkInterface(deleteInstanceNetworkInterfaceOptions *DeleteInstanceNetworkInterfaceOptions)`, func() { + Describe(`DeleteInstanceNetworkAttachment(deleteInstanceNetworkAttachmentOptions *DeleteInstanceNetworkAttachmentOptions)`, func() { version := "testString" - deleteInstanceNetworkInterfacePath := "/instances/testString/network_interfaces/testString" + deleteInstanceNetworkAttachmentPath := "/instances/testString/network_attachments/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(deleteInstanceNetworkInterfacePath)) + Expect(req.URL.EscapedPath()).To(Equal(deleteInstanceNetworkAttachmentPath)) 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(204) + res.WriteHeader(202) })) }) - It(`Invoke DeleteInstanceNetworkInterface successfully`, func() { + It(`Invoke DeleteInstanceNetworkAttachment successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -24085,22 +24565,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.DeleteInstanceNetworkInterface(nil) + response, operationErr := vpcService.DeleteInstanceNetworkAttachment(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) - // Construct an instance of the DeleteInstanceNetworkInterfaceOptions model - deleteInstanceNetworkInterfaceOptionsModel := new(vpcv1.DeleteInstanceNetworkInterfaceOptions) - deleteInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") - deleteInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - deleteInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteInstanceNetworkAttachmentOptions model + deleteInstanceNetworkAttachmentOptionsModel := new(vpcv1.DeleteInstanceNetworkAttachmentOptions) + deleteInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + deleteInstanceNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + deleteInstanceNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteInstanceNetworkInterface(deleteInstanceNetworkInterfaceOptionsModel) + response, operationErr = vpcService.DeleteInstanceNetworkAttachment(deleteInstanceNetworkAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) }) - It(`Invoke DeleteInstanceNetworkInterface with error: Operation validation and request error`, func() { + It(`Invoke DeleteInstanceNetworkAttachment with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -24109,22 +24589,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteInstanceNetworkInterfaceOptions model - deleteInstanceNetworkInterfaceOptionsModel := new(vpcv1.DeleteInstanceNetworkInterfaceOptions) - deleteInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") - deleteInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - deleteInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteInstanceNetworkAttachmentOptions model + deleteInstanceNetworkAttachmentOptionsModel := new(vpcv1.DeleteInstanceNetworkAttachmentOptions) + deleteInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + deleteInstanceNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + deleteInstanceNetworkAttachmentOptionsModel.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.DeleteInstanceNetworkInterface(deleteInstanceNetworkInterfaceOptionsModel) + response, operationErr := vpcService.DeleteInstanceNetworkAttachment(deleteInstanceNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - // Construct a second instance of the DeleteInstanceNetworkInterfaceOptions model with no property values - deleteInstanceNetworkInterfaceOptionsModelNew := new(vpcv1.DeleteInstanceNetworkInterfaceOptions) + // Construct a second instance of the DeleteInstanceNetworkAttachmentOptions model with no property values + deleteInstanceNetworkAttachmentOptionsModelNew := new(vpcv1.DeleteInstanceNetworkAttachmentOptions) // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteInstanceNetworkInterface(deleteInstanceNetworkInterfaceOptionsModelNew) + response, operationErr = vpcService.DeleteInstanceNetworkAttachment(deleteInstanceNetworkAttachmentOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) }) @@ -24133,16 +24613,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions) - Operation response error`, func() { + Describe(`GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptions *GetInstanceNetworkAttachmentOptions) - Operation response error`, func() { version := "testString" - getInstanceNetworkInterfacePath := "/instances/testString/network_interfaces/testString" + getInstanceNetworkAttachmentPath := "/instances/testString/network_attachments/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(getInstanceNetworkInterfacePath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceNetworkAttachmentPath)) 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))})) @@ -24151,7 +24631,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetInstanceNetworkInterface with error: Operation response processing error`, func() { + It(`Invoke GetInstanceNetworkAttachment with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -24160,20 +24640,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceNetworkInterfaceOptions model - getInstanceNetworkInterfaceOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceOptions) - getInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - getInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceNetworkAttachmentOptions model + getInstanceNetworkAttachmentOptionsModel := new(vpcv1.GetInstanceNetworkAttachmentOptions) + getInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + getInstanceNetworkAttachmentOptionsModel.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.GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptionsModel) 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.GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptionsModel) + result, response, operationErr = vpcService.GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -24183,16 +24663,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions)`, func() { + Describe(`GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptions *GetInstanceNetworkAttachmentOptions)`, func() { version := "testString" - getInstanceNetworkInterfacePath := "/instances/testString/network_interfaces/testString" + getInstanceNetworkAttachmentPath := "/instances/testString/network_attachments/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(getInstanceNetworkInterfacePath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceNetworkAttachmentPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -24203,10 +24683,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "network_interface", "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"}], "status": "available", "subnet": {"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"}, "type": "primary"}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "lifecycle_state": "stable", "name": "my-instance-network-attachment", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "instance_network_attachment", "subnet": {"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"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}`) })) }) - It(`Invoke GetInstanceNetworkInterface successfully with retries`, func() { + It(`Invoke GetInstanceNetworkAttachment successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -24216,22 +24696,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetInstanceNetworkInterfaceOptions model - getInstanceNetworkInterfaceOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceOptions) - getInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - getInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceNetworkAttachmentOptions model + getInstanceNetworkAttachmentOptionsModel := new(vpcv1.GetInstanceNetworkAttachmentOptions) + getInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + getInstanceNetworkAttachmentOptionsModel.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.GetInstanceNetworkInterfaceWithContext(ctx, getInstanceNetworkInterfaceOptionsModel) + _, _, operationErr := vpcService.GetInstanceNetworkAttachmentWithContext(ctx, getInstanceNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -24239,7 +24719,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetInstanceNetworkInterfaceWithContext(ctx, getInstanceNetworkInterfaceOptionsModel) + _, _, operationErr = vpcService.GetInstanceNetworkAttachmentWithContext(ctx, getInstanceNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -24253,7 +24733,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInstanceNetworkInterfacePath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceNetworkAttachmentPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -24261,10 +24741,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "network_interface", "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"}], "status": "available", "subnet": {"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"}, "type": "primary"}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "lifecycle_state": "stable", "name": "my-instance-network-attachment", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "instance_network_attachment", "subnet": {"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"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}`) })) }) - It(`Invoke GetInstanceNetworkInterface successfully`, func() { + It(`Invoke GetInstanceNetworkAttachment successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -24274,25 +24754,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetInstanceNetworkInterface(nil) + result, response, operationErr := vpcService.GetInstanceNetworkAttachment(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetInstanceNetworkInterfaceOptions model - getInstanceNetworkInterfaceOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceOptions) - getInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - getInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceNetworkAttachmentOptions model + getInstanceNetworkAttachmentOptionsModel := new(vpcv1.GetInstanceNetworkAttachmentOptions) + getInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + getInstanceNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptionsModel) + result, response, operationErr = vpcService.GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetInstanceNetworkInterface with error: Operation validation and request error`, func() { + It(`Invoke GetInstanceNetworkAttachment with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -24301,23 +24781,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceNetworkInterfaceOptions model - getInstanceNetworkInterfaceOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceOptions) - getInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - getInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceNetworkAttachmentOptions model + getInstanceNetworkAttachmentOptionsModel := new(vpcv1.GetInstanceNetworkAttachmentOptions) + getInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + getInstanceNetworkAttachmentOptionsModel.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.GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptionsModel) 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 GetInstanceNetworkInterfaceOptions model with no property values - getInstanceNetworkInterfaceOptionsModelNew := new(vpcv1.GetInstanceNetworkInterfaceOptions) + // Construct a second instance of the GetInstanceNetworkAttachmentOptions model with no property values + getInstanceNetworkAttachmentOptionsModelNew := new(vpcv1.GetInstanceNetworkAttachmentOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptionsModelNew) + result, response, operationErr = vpcService.GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -24335,7 +24815,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetInstanceNetworkInterface successfully`, func() { + It(`Invoke GetInstanceNetworkAttachment successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -24344,14 +24824,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceNetworkInterfaceOptions model - getInstanceNetworkInterfaceOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceOptions) - getInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - getInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceNetworkAttachmentOptions model + getInstanceNetworkAttachmentOptionsModel := new(vpcv1.GetInstanceNetworkAttachmentOptions) + getInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + getInstanceNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -24363,16 +24843,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions) - Operation response error`, func() { + Describe(`UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptions *UpdateInstanceNetworkAttachmentOptions) - Operation response error`, func() { version := "testString" - updateInstanceNetworkInterfacePath := "/instances/testString/network_interfaces/testString" + updateInstanceNetworkAttachmentPath := "/instances/testString/network_attachments/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(updateInstanceNetworkInterfacePath)) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceNetworkAttachmentPath)) 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))})) @@ -24381,7 +24861,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateInstanceNetworkInterface with error: Operation response processing error`, func() { + It(`Invoke UpdateInstanceNetworkAttachment with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -24390,28 +24870,27 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the NetworkInterfacePatch model - networkInterfacePatchModel := new(vpcv1.NetworkInterfacePatch) - networkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) - networkInterfacePatchModel.Name = core.StringPtr("my-network-interface-1") - networkInterfacePatchModelAsPatch, asPatchErr := networkInterfacePatchModel.AsPatch() + // Construct an instance of the InstanceNetworkAttachmentPatch model + instanceNetworkAttachmentPatchModel := new(vpcv1.InstanceNetworkAttachmentPatch) + instanceNetworkAttachmentPatchModel.Name = core.StringPtr("my-instance-network-attachment-updated") + instanceNetworkAttachmentPatchModelAsPatch, asPatchErr := instanceNetworkAttachmentPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceNetworkInterfaceOptions model - updateInstanceNetworkInterfaceOptionsModel := new(vpcv1.UpdateInstanceNetworkInterfaceOptions) - updateInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") - updateInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - updateInstanceNetworkInterfaceOptionsModel.NetworkInterfacePatch = networkInterfacePatchModelAsPatch - updateInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceNetworkAttachmentOptions model + updateInstanceNetworkAttachmentOptionsModel := new(vpcv1.UpdateInstanceNetworkAttachmentOptions) + updateInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + updateInstanceNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + updateInstanceNetworkAttachmentOptionsModel.InstanceNetworkAttachmentPatch = instanceNetworkAttachmentPatchModelAsPatch + updateInstanceNetworkAttachmentOptionsModel.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.UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptionsModel) 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.UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptionsModel) + result, response, operationErr = vpcService.UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -24421,16 +24900,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions)`, func() { + Describe(`UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptions *UpdateInstanceNetworkAttachmentOptions)`, func() { version := "testString" - updateInstanceNetworkInterfacePath := "/instances/testString/network_interfaces/testString" + updateInstanceNetworkAttachmentPath := "/instances/testString/network_attachments/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(updateInstanceNetworkInterfacePath)) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceNetworkAttachmentPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -24457,10 +24936,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "network_interface", "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"}], "status": "available", "subnet": {"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"}, "type": "primary"}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "lifecycle_state": "stable", "name": "my-instance-network-attachment", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "instance_network_attachment", "subnet": {"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"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}`) })) }) - It(`Invoke UpdateInstanceNetworkInterface successfully with retries`, func() { + It(`Invoke UpdateInstanceNetworkAttachment successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -24470,30 +24949,29 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the NetworkInterfacePatch model - networkInterfacePatchModel := new(vpcv1.NetworkInterfacePatch) - networkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) - networkInterfacePatchModel.Name = core.StringPtr("my-network-interface-1") - networkInterfacePatchModelAsPatch, asPatchErr := networkInterfacePatchModel.AsPatch() + // Construct an instance of the InstanceNetworkAttachmentPatch model + instanceNetworkAttachmentPatchModel := new(vpcv1.InstanceNetworkAttachmentPatch) + instanceNetworkAttachmentPatchModel.Name = core.StringPtr("my-instance-network-attachment-updated") + instanceNetworkAttachmentPatchModelAsPatch, asPatchErr := instanceNetworkAttachmentPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceNetworkInterfaceOptions model - updateInstanceNetworkInterfaceOptionsModel := new(vpcv1.UpdateInstanceNetworkInterfaceOptions) - updateInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") - updateInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - updateInstanceNetworkInterfaceOptionsModel.NetworkInterfacePatch = networkInterfacePatchModelAsPatch - updateInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceNetworkAttachmentOptions model + updateInstanceNetworkAttachmentOptionsModel := new(vpcv1.UpdateInstanceNetworkAttachmentOptions) + updateInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + updateInstanceNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + updateInstanceNetworkAttachmentOptionsModel.InstanceNetworkAttachmentPatch = instanceNetworkAttachmentPatchModelAsPatch + updateInstanceNetworkAttachmentOptionsModel.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.UpdateInstanceNetworkInterfaceWithContext(ctx, updateInstanceNetworkInterfaceOptionsModel) + _, _, operationErr := vpcService.UpdateInstanceNetworkAttachmentWithContext(ctx, updateInstanceNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -24501,7 +24979,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateInstanceNetworkInterfaceWithContext(ctx, updateInstanceNetworkInterfaceOptionsModel) + _, _, operationErr = vpcService.UpdateInstanceNetworkAttachmentWithContext(ctx, updateInstanceNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -24515,7 +24993,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateInstanceNetworkInterfacePath)) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceNetworkAttachmentPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -24539,10 +25017,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "network_interface", "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"}], "status": "available", "subnet": {"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"}, "type": "primary"}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "id": "0767-d54eb633-98ea-459d-aa00-6a8e780175a7", "lifecycle_state": "stable", "name": "my-instance-network-attachment", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "instance_network_attachment", "subnet": {"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"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}}`) })) }) - It(`Invoke UpdateInstanceNetworkInterface successfully`, func() { + It(`Invoke UpdateInstanceNetworkAttachment successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -24552,33 +25030,32 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateInstanceNetworkInterface(nil) + result, response, operationErr := vpcService.UpdateInstanceNetworkAttachment(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the NetworkInterfacePatch model - networkInterfacePatchModel := new(vpcv1.NetworkInterfacePatch) - networkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) - networkInterfacePatchModel.Name = core.StringPtr("my-network-interface-1") - networkInterfacePatchModelAsPatch, asPatchErr := networkInterfacePatchModel.AsPatch() + // Construct an instance of the InstanceNetworkAttachmentPatch model + instanceNetworkAttachmentPatchModel := new(vpcv1.InstanceNetworkAttachmentPatch) + instanceNetworkAttachmentPatchModel.Name = core.StringPtr("my-instance-network-attachment-updated") + instanceNetworkAttachmentPatchModelAsPatch, asPatchErr := instanceNetworkAttachmentPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceNetworkInterfaceOptions model - updateInstanceNetworkInterfaceOptionsModel := new(vpcv1.UpdateInstanceNetworkInterfaceOptions) - updateInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") - updateInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - updateInstanceNetworkInterfaceOptionsModel.NetworkInterfacePatch = networkInterfacePatchModelAsPatch - updateInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceNetworkAttachmentOptions model + updateInstanceNetworkAttachmentOptionsModel := new(vpcv1.UpdateInstanceNetworkAttachmentOptions) + updateInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + updateInstanceNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + updateInstanceNetworkAttachmentOptionsModel.InstanceNetworkAttachmentPatch = instanceNetworkAttachmentPatchModelAsPatch + updateInstanceNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptionsModel) + result, response, operationErr = vpcService.UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateInstanceNetworkInterface with error: Operation validation and request error`, func() { + It(`Invoke UpdateInstanceNetworkAttachment with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -24587,31 +25064,30 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the NetworkInterfacePatch model - networkInterfacePatchModel := new(vpcv1.NetworkInterfacePatch) - networkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) - networkInterfacePatchModel.Name = core.StringPtr("my-network-interface-1") - networkInterfacePatchModelAsPatch, asPatchErr := networkInterfacePatchModel.AsPatch() + // Construct an instance of the InstanceNetworkAttachmentPatch model + instanceNetworkAttachmentPatchModel := new(vpcv1.InstanceNetworkAttachmentPatch) + instanceNetworkAttachmentPatchModel.Name = core.StringPtr("my-instance-network-attachment-updated") + instanceNetworkAttachmentPatchModelAsPatch, asPatchErr := instanceNetworkAttachmentPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceNetworkInterfaceOptions model - updateInstanceNetworkInterfaceOptionsModel := new(vpcv1.UpdateInstanceNetworkInterfaceOptions) - updateInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") - updateInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - updateInstanceNetworkInterfaceOptionsModel.NetworkInterfacePatch = networkInterfacePatchModelAsPatch - updateInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceNetworkAttachmentOptions model + updateInstanceNetworkAttachmentOptionsModel := new(vpcv1.UpdateInstanceNetworkAttachmentOptions) + updateInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + updateInstanceNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + updateInstanceNetworkAttachmentOptionsModel.InstanceNetworkAttachmentPatch = instanceNetworkAttachmentPatchModelAsPatch + updateInstanceNetworkAttachmentOptionsModel.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.UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptionsModel) 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 UpdateInstanceNetworkInterfaceOptions model with no property values - updateInstanceNetworkInterfaceOptionsModelNew := new(vpcv1.UpdateInstanceNetworkInterfaceOptions) + // Construct a second instance of the UpdateInstanceNetworkAttachmentOptions model with no property values + updateInstanceNetworkAttachmentOptionsModelNew := new(vpcv1.UpdateInstanceNetworkAttachmentOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptionsModelNew) + result, response, operationErr = vpcService.UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -24629,7 +25105,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateInstanceNetworkInterface successfully`, func() { + It(`Invoke UpdateInstanceNetworkAttachment successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -24638,22 +25114,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the NetworkInterfacePatch model - networkInterfacePatchModel := new(vpcv1.NetworkInterfacePatch) - networkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) - networkInterfacePatchModel.Name = core.StringPtr("my-network-interface-1") - networkInterfacePatchModelAsPatch, asPatchErr := networkInterfacePatchModel.AsPatch() + // Construct an instance of the InstanceNetworkAttachmentPatch model + instanceNetworkAttachmentPatchModel := new(vpcv1.InstanceNetworkAttachmentPatch) + instanceNetworkAttachmentPatchModel.Name = core.StringPtr("my-instance-network-attachment-updated") + instanceNetworkAttachmentPatchModelAsPatch, asPatchErr := instanceNetworkAttachmentPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceNetworkInterfaceOptions model - updateInstanceNetworkInterfaceOptionsModel := new(vpcv1.UpdateInstanceNetworkInterfaceOptions) - updateInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") - updateInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - updateInstanceNetworkInterfaceOptionsModel.NetworkInterfacePatch = networkInterfacePatchModelAsPatch - updateInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceNetworkAttachmentOptions model + updateInstanceNetworkAttachmentOptionsModel := new(vpcv1.UpdateInstanceNetworkAttachmentOptions) + updateInstanceNetworkAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + updateInstanceNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + updateInstanceNetworkAttachmentOptionsModel.InstanceNetworkAttachmentPatch = instanceNetworkAttachmentPatchModelAsPatch + updateInstanceNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -24665,16 +25140,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions) - Operation response error`, func() { + Describe(`ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions) - Operation response error`, func() { version := "testString" - listInstanceNetworkInterfaceFloatingIpsPath := "/instances/testString/network_interfaces/testString/floating_ips" + listInstanceNetworkInterfacesPath := "/instances/testString/network_interfaces" 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(listInstanceNetworkInterfaceFloatingIpsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceNetworkInterfacesPath)) 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))})) @@ -24683,7 +25158,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListInstanceNetworkInterfaceFloatingIps with error: Operation response processing error`, func() { + It(`Invoke ListInstanceNetworkInterfaces with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -24692,20 +25167,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceNetworkInterfaceFloatingIpsOptions model - listInstanceNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListInstanceNetworkInterfaceFloatingIpsOptions) - listInstanceNetworkInterfaceFloatingIpsOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - listInstanceNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceNetworkInterfacesOptions model + listInstanceNetworkInterfacesOptionsModel := new(vpcv1.ListInstanceNetworkInterfacesOptions) + listInstanceNetworkInterfacesOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceNetworkInterfacesOptionsModel.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.ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptionsModel) + result, response, operationErr := vpcService.ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptionsModel) 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.ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptionsModel) + result, response, operationErr = vpcService.ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -24715,16 +25189,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions)`, func() { + Describe(`ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions)`, func() { version := "testString" - listInstanceNetworkInterfaceFloatingIpsPath := "/instances/testString/network_interfaces/testString/floating_ips" + listInstanceNetworkInterfacesPath := "/instances/testString/network_interfaces" 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(listInstanceNetworkInterfaceFloatingIpsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceNetworkInterfacesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -24735,10 +25209,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"floating_ips": [{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface"}, "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", `{"network_interfaces": [{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "network_interface", "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"}], "status": "available", "subnet": {"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"}, "type": "primary"}]}`) })) }) - It(`Invoke ListInstanceNetworkInterfaceFloatingIps successfully with retries`, func() { + It(`Invoke ListInstanceNetworkInterfaces successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -24748,22 +25222,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListInstanceNetworkInterfaceFloatingIpsOptions model - listInstanceNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListInstanceNetworkInterfaceFloatingIpsOptions) - listInstanceNetworkInterfaceFloatingIpsOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - listInstanceNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceNetworkInterfacesOptions model + listInstanceNetworkInterfacesOptionsModel := new(vpcv1.ListInstanceNetworkInterfacesOptions) + listInstanceNetworkInterfacesOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceNetworkInterfacesOptionsModel.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.ListInstanceNetworkInterfaceFloatingIpsWithContext(ctx, listInstanceNetworkInterfaceFloatingIpsOptionsModel) + _, _, operationErr := vpcService.ListInstanceNetworkInterfacesWithContext(ctx, listInstanceNetworkInterfacesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptionsModel) + result, response, operationErr := vpcService.ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -24771,7 +25244,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListInstanceNetworkInterfaceFloatingIpsWithContext(ctx, listInstanceNetworkInterfaceFloatingIpsOptionsModel) + _, _, operationErr = vpcService.ListInstanceNetworkInterfacesWithContext(ctx, listInstanceNetworkInterfacesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -24785,7 +25258,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceNetworkInterfaceFloatingIpsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceNetworkInterfacesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -24793,10 +25266,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"floating_ips": [{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface"}, "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", `{"network_interfaces": [{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "network_interface", "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"}], "status": "available", "subnet": {"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"}, "type": "primary"}]}`) })) }) - It(`Invoke ListInstanceNetworkInterfaceFloatingIps successfully`, func() { + It(`Invoke ListInstanceNetworkInterfaces successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -24806,25 +25279,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListInstanceNetworkInterfaceFloatingIps(nil) + result, response, operationErr := vpcService.ListInstanceNetworkInterfaces(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListInstanceNetworkInterfaceFloatingIpsOptions model - listInstanceNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListInstanceNetworkInterfaceFloatingIpsOptions) - listInstanceNetworkInterfaceFloatingIpsOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - listInstanceNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceNetworkInterfacesOptions model + listInstanceNetworkInterfacesOptionsModel := new(vpcv1.ListInstanceNetworkInterfacesOptions) + listInstanceNetworkInterfacesOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptionsModel) + result, response, operationErr = vpcService.ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListInstanceNetworkInterfaceFloatingIps with error: Operation validation and request error`, func() { + It(`Invoke ListInstanceNetworkInterfaces with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -24833,23 +25305,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceNetworkInterfaceFloatingIpsOptions model - listInstanceNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListInstanceNetworkInterfaceFloatingIpsOptions) - listInstanceNetworkInterfaceFloatingIpsOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - listInstanceNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceNetworkInterfacesOptions model + listInstanceNetworkInterfacesOptionsModel := new(vpcv1.ListInstanceNetworkInterfacesOptions) + listInstanceNetworkInterfacesOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceNetworkInterfacesOptionsModel.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.ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptionsModel) + result, response, operationErr := vpcService.ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptionsModel) 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 ListInstanceNetworkInterfaceFloatingIpsOptions model with no property values - listInstanceNetworkInterfaceFloatingIpsOptionsModelNew := new(vpcv1.ListInstanceNetworkInterfaceFloatingIpsOptions) + // Construct a second instance of the ListInstanceNetworkInterfacesOptions model with no property values + listInstanceNetworkInterfacesOptionsModelNew := new(vpcv1.ListInstanceNetworkInterfacesOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptionsModelNew) + result, response, operationErr = vpcService.ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -24867,7 +25338,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListInstanceNetworkInterfaceFloatingIps successfully`, func() { + It(`Invoke ListInstanceNetworkInterfaces successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -24876,14 +25347,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceNetworkInterfaceFloatingIpsOptions model - listInstanceNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListInstanceNetworkInterfaceFloatingIpsOptions) - listInstanceNetworkInterfaceFloatingIpsOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - listInstanceNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceNetworkInterfacesOptions model + listInstanceNetworkInterfacesOptionsModel := new(vpcv1.ListInstanceNetworkInterfacesOptions) + listInstanceNetworkInterfacesOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptionsModel) + result, response, operationErr := vpcService.ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -24895,24 +25365,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`RemoveInstanceNetworkInterfaceFloatingIP(removeInstanceNetworkInterfaceFloatingIPOptions *RemoveInstanceNetworkInterfaceFloatingIPOptions)`, func() { + Describe(`CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions) - Operation response error`, func() { version := "testString" - removeInstanceNetworkInterfaceFloatingIPPath := "/instances/testString/network_interfaces/testString/floating_ips/testString" - Context(`Using mock server endpoint`, func() { + createInstanceNetworkInterfacePath := "/instances/testString/network_interfaces" + 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(removeInstanceNetworkInterfaceFloatingIPPath)) - Expect(req.Method).To(Equal("DELETE")) - + Expect(req.URL.EscapedPath()).To(Equal(createInstanceNetworkInterfacePath)) + 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(204) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke RemoveInstanceNetworkInterfaceFloatingIP successfully`, func() { + It(`Invoke CreateInstanceNetworkInterface with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -24921,76 +25392,87 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.RemoveInstanceNetworkInterfaceFloatingIP(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) + // 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 RemoveInstanceNetworkInterfaceFloatingIPOptions model - removeInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.RemoveInstanceNetworkInterfaceFloatingIPOptions) - removeInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") - removeInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - removeInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - removeInstanceNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model + networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) + networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.RemoveInstanceNetworkInterfaceFloatingIP(removeInstanceNetworkInterfaceFloatingIPOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke RemoveInstanceNetworkInterfaceFloatingIP 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 SecurityGroupIdentityByID model + securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) + securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - // Construct an instance of the RemoveInstanceNetworkInterfaceFloatingIPOptions model - removeInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.RemoveInstanceNetworkInterfaceFloatingIPOptions) - removeInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") - removeInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - removeInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - removeInstanceNetworkInterfaceFloatingIPOptionsModel.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.RemoveInstanceNetworkInterfaceFloatingIP(removeInstanceNetworkInterfaceFloatingIPOptionsModel) + // Construct an instance of the CreateInstanceNetworkInterfaceOptions model + createInstanceNetworkInterfaceOptionsModel := new(vpcv1.CreateInstanceNetworkInterfaceOptions) + createInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") + createInstanceNetworkInterfaceOptionsModel.Subnet = subnetIdentityModel + createInstanceNetworkInterfaceOptionsModel.AllowIPSpoofing = core.BoolPtr(true) + createInstanceNetworkInterfaceOptionsModel.Name = core.StringPtr("my-instance-network-interface") + createInstanceNetworkInterfaceOptionsModel.PrimaryIP = networkInterfaceIPPrototypeModel + createInstanceNetworkInterfaceOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + createInstanceNetworkInterfaceOptionsModel.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.CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the RemoveInstanceNetworkInterfaceFloatingIPOptions model with no property values - removeInstanceNetworkInterfaceFloatingIPOptionsModelNew := new(vpcv1.RemoveInstanceNetworkInterfaceFloatingIPOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.RemoveInstanceNetworkInterfaceFloatingIP(removeInstanceNetworkInterfaceFloatingIPOptionsModelNew) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptions *GetInstanceNetworkInterfaceFloatingIPOptions) - Operation response error`, func() { + Describe(`CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions)`, func() { version := "testString" - getInstanceNetworkInterfaceFloatingIPPath := "/instances/testString/network_interfaces/testString/floating_ips/testString" - Context(`Using mock server endpoint with invalid JSON response`, func() { + createInstanceNetworkInterfacePath := "/instances/testString/network_interfaces" + 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(getInstanceNetworkInterfaceFloatingIPPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createInstanceNetworkInterfacePath)) + 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(200) - fmt.Fprint(res, `} this is not valid json {`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "network_interface", "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"}], "status": "available", "subnet": {"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"}, "type": "primary"}`) })) }) - It(`Invoke GetInstanceNetworkInterfaceFloatingIP with error: Operation response processing error`, func() { + It(`Invoke CreateInstanceNetworkInterface successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -24998,81 +25480,42 @@ var _ = Describe(`VpcV1`, func() { }) Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) - // Construct an instance of the GetInstanceNetworkInterfaceFloatingIPOptions model - getInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceFloatingIPOptions) - getInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - getInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - getInstanceNetworkInterfaceFloatingIPOptionsModel.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.GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptionsModel) - 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.GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptions *GetInstanceNetworkInterfaceFloatingIPOptions)`, func() { - version := "testString" - getInstanceNetworkInterfaceFloatingIPPath := "/instances/testString/network_interfaces/testString/floating_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(getInstanceNetworkInterfaceFloatingIPPath)) - Expect(req.Method).To(Equal("GET")) + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - 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) + // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model + networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) + networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) - })) - }) - It(`Invoke GetInstanceNetworkInterfaceFloatingIP 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 SecurityGroupIdentityByID model + securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) + securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - // Construct an instance of the GetInstanceNetworkInterfaceFloatingIPOptions model - getInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceFloatingIPOptions) - getInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - getInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - getInstanceNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateInstanceNetworkInterfaceOptions model + createInstanceNetworkInterfaceOptionsModel := new(vpcv1.CreateInstanceNetworkInterfaceOptions) + createInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") + createInstanceNetworkInterfaceOptionsModel.Subnet = subnetIdentityModel + createInstanceNetworkInterfaceOptionsModel.AllowIPSpoofing = core.BoolPtr(true) + createInstanceNetworkInterfaceOptionsModel.Name = core.StringPtr("my-instance-network-interface") + createInstanceNetworkInterfaceOptionsModel.PrimaryIP = networkInterfaceIPPrototypeModel + createInstanceNetworkInterfaceOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + createInstanceNetworkInterfaceOptionsModel.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.GetInstanceNetworkInterfaceFloatingIPWithContext(ctx, getInstanceNetworkInterfaceFloatingIPOptionsModel) + _, _, operationErr := vpcService.CreateInstanceNetworkInterfaceWithContext(ctx, createInstanceNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr := vpcService.CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -25080,7 +25523,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetInstanceNetworkInterfaceFloatingIPWithContext(ctx, getInstanceNetworkInterfaceFloatingIPOptionsModel) + _, _, operationErr = vpcService.CreateInstanceNetworkInterfaceWithContext(ctx, createInstanceNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -25094,18 +25537,34 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInstanceNetworkInterfaceFloatingIPPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createInstanceNetworkInterfacePath)) + 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(200) - fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "network_interface", "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"}], "status": "available", "subnet": {"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"}, "type": "primary"}`) })) }) - It(`Invoke GetInstanceNetworkInterfaceFloatingIP successfully`, func() { + It(`Invoke CreateInstanceNetworkInterface successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -25115,26 +25574,43 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetInstanceNetworkInterfaceFloatingIP(nil) + result, response, operationErr := vpcService.CreateInstanceNetworkInterface(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetInstanceNetworkInterfaceFloatingIPOptions model - getInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceFloatingIPOptions) - getInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - getInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - getInstanceNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // 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 NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model + networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) + networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // 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 CreateInstanceNetworkInterfaceOptions model + createInstanceNetworkInterfaceOptionsModel := new(vpcv1.CreateInstanceNetworkInterfaceOptions) + createInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") + createInstanceNetworkInterfaceOptionsModel.Subnet = subnetIdentityModel + createInstanceNetworkInterfaceOptionsModel.AllowIPSpoofing = core.BoolPtr(true) + createInstanceNetworkInterfaceOptionsModel.Name = core.StringPtr("my-instance-network-interface") + createInstanceNetworkInterfaceOptionsModel.PrimaryIP = networkInterfaceIPPrototypeModel + createInstanceNetworkInterfaceOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + createInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr = vpcService.CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetInstanceNetworkInterfaceFloatingIP with error: Operation validation and request error`, func() { + It(`Invoke CreateInstanceNetworkInterface with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -25143,24 +25619,41 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceNetworkInterfaceFloatingIPOptions model - getInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceFloatingIPOptions) - getInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - getInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - getInstanceNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // 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 NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model + networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) + networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // 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 CreateInstanceNetworkInterfaceOptions model + createInstanceNetworkInterfaceOptionsModel := new(vpcv1.CreateInstanceNetworkInterfaceOptions) + createInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") + createInstanceNetworkInterfaceOptionsModel.Subnet = subnetIdentityModel + createInstanceNetworkInterfaceOptionsModel.AllowIPSpoofing = core.BoolPtr(true) + createInstanceNetworkInterfaceOptionsModel.Name = core.StringPtr("my-instance-network-interface") + createInstanceNetworkInterfaceOptionsModel.PrimaryIP = networkInterfaceIPPrototypeModel + createInstanceNetworkInterfaceOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + createInstanceNetworkInterfaceOptionsModel.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.GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr := vpcService.CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptionsModel) 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 GetInstanceNetworkInterfaceFloatingIPOptions model with no property values - getInstanceNetworkInterfaceFloatingIPOptionsModelNew := new(vpcv1.GetInstanceNetworkInterfaceFloatingIPOptions) + // Construct a second instance of the CreateInstanceNetworkInterfaceOptions model with no property values + createInstanceNetworkInterfaceOptionsModelNew := new(vpcv1.CreateInstanceNetworkInterfaceOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptionsModelNew) + result, response, operationErr = vpcService.CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -25175,10 +25668,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke GetInstanceNetworkInterfaceFloatingIP successfully`, func() { + It(`Invoke CreateInstanceNetworkInterface successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -25187,15 +25680,32 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceNetworkInterfaceFloatingIPOptions model - getInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceFloatingIPOptions) - getInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - getInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - getInstanceNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // 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 NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model + networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) + networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // 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 CreateInstanceNetworkInterfaceOptions model + createInstanceNetworkInterfaceOptionsModel := new(vpcv1.CreateInstanceNetworkInterfaceOptions) + createInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") + createInstanceNetworkInterfaceOptionsModel.Subnet = subnetIdentityModel + createInstanceNetworkInterfaceOptionsModel.AllowIPSpoofing = core.BoolPtr(true) + createInstanceNetworkInterfaceOptionsModel.Name = core.StringPtr("my-instance-network-interface") + createInstanceNetworkInterfaceOptionsModel.PrimaryIP = networkInterfaceIPPrototypeModel + createInstanceNetworkInterfaceOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + createInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr := vpcService.CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -25207,25 +25717,100 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptions *AddInstanceNetworkInterfaceFloatingIPOptions) - Operation response error`, func() { + Describe(`DeleteInstanceNetworkInterface(deleteInstanceNetworkInterfaceOptions *DeleteInstanceNetworkInterfaceOptions)`, func() { version := "testString" - addInstanceNetworkInterfaceFloatingIPPath := "/instances/testString/network_interfaces/testString/floating_ips/testString" + deleteInstanceNetworkInterfacePath := "/instances/testString/network_interfaces/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(deleteInstanceNetworkInterfacePath)) + 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(204) + })) + }) + It(`Invoke DeleteInstanceNetworkInterface 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.DeleteInstanceNetworkInterface(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteInstanceNetworkInterfaceOptions model + deleteInstanceNetworkInterfaceOptionsModel := new(vpcv1.DeleteInstanceNetworkInterfaceOptions) + deleteInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") + deleteInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + deleteInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteInstanceNetworkInterface(deleteInstanceNetworkInterfaceOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteInstanceNetworkInterface 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 DeleteInstanceNetworkInterfaceOptions model + deleteInstanceNetworkInterfaceOptionsModel := new(vpcv1.DeleteInstanceNetworkInterfaceOptions) + deleteInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") + deleteInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + deleteInstanceNetworkInterfaceOptionsModel.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.DeleteInstanceNetworkInterface(deleteInstanceNetworkInterfaceOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteInstanceNetworkInterfaceOptions model with no property values + deleteInstanceNetworkInterfaceOptionsModelNew := new(vpcv1.DeleteInstanceNetworkInterfaceOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteInstanceNetworkInterface(deleteInstanceNetworkInterfaceOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions) - Operation response error`, func() { + version := "testString" + getInstanceNetworkInterfacePath := "/instances/testString/network_interfaces/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(addInstanceNetworkInterfaceFloatingIPPath)) - Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceNetworkInterfacePath)) + 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(201) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke AddInstanceNetworkInterfaceFloatingIP with error: Operation response processing error`, func() { + It(`Invoke GetInstanceNetworkInterface with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -25234,21 +25819,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the AddInstanceNetworkInterfaceFloatingIPOptions model - addInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddInstanceNetworkInterfaceFloatingIPOptions) - addInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") - addInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - addInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - addInstanceNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceNetworkInterfaceOptions model + getInstanceNetworkInterfaceOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceOptions) + getInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + getInstanceNetworkInterfaceOptionsModel.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.AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr := vpcService.GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptionsModel) 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.AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr = vpcService.GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -25258,17 +25842,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptions *AddInstanceNetworkInterfaceFloatingIPOptions)`, func() { + Describe(`GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions)`, func() { version := "testString" - addInstanceNetworkInterfaceFloatingIPPath := "/instances/testString/network_interfaces/testString/floating_ips/testString" + getInstanceNetworkInterfacePath := "/instances/testString/network_interfaces/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(addInstanceNetworkInterfaceFloatingIPPath)) - Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceNetworkInterfacePath)) + 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))})) @@ -25277,11 +25861,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "network_interface", "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"}], "status": "available", "subnet": {"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"}, "type": "primary"}`) })) }) - It(`Invoke AddInstanceNetworkInterfaceFloatingIP successfully with retries`, func() { + It(`Invoke GetInstanceNetworkInterface successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -25291,23 +25875,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the AddInstanceNetworkInterfaceFloatingIPOptions model - addInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddInstanceNetworkInterfaceFloatingIPOptions) - addInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") - addInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - addInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - addInstanceNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceNetworkInterfaceOptions model + getInstanceNetworkInterfaceOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceOptions) + getInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + getInstanceNetworkInterfaceOptionsModel.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.AddInstanceNetworkInterfaceFloatingIPWithContext(ctx, addInstanceNetworkInterfaceFloatingIPOptionsModel) + _, _, operationErr := vpcService.GetInstanceNetworkInterfaceWithContext(ctx, getInstanceNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr := vpcService.GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -25315,7 +25898,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.AddInstanceNetworkInterfaceFloatingIPWithContext(ctx, addInstanceNetworkInterfaceFloatingIPOptionsModel) + _, _, operationErr = vpcService.GetInstanceNetworkInterfaceWithContext(ctx, getInstanceNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -25329,18 +25912,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(addInstanceNetworkInterfaceFloatingIPPath)) - Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceNetworkInterfacePath)) + 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(201) - fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "network_interface", "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"}], "status": "available", "subnet": {"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"}, "type": "primary"}`) })) }) - It(`Invoke AddInstanceNetworkInterfaceFloatingIP successfully`, func() { + It(`Invoke GetInstanceNetworkInterface successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -25350,26 +25933,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.AddInstanceNetworkInterfaceFloatingIP(nil) + result, response, operationErr := vpcService.GetInstanceNetworkInterface(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the AddInstanceNetworkInterfaceFloatingIPOptions model - addInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddInstanceNetworkInterfaceFloatingIPOptions) - addInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") - addInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - addInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - addInstanceNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceNetworkInterfaceOptions model + getInstanceNetworkInterfaceOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceOptions) + getInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + getInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr = vpcService.GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke AddInstanceNetworkInterfaceFloatingIP with error: Operation validation and request error`, func() { + It(`Invoke GetInstanceNetworkInterface with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -25378,24 +25960,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the AddInstanceNetworkInterfaceFloatingIPOptions model - addInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddInstanceNetworkInterfaceFloatingIPOptions) - addInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") - addInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - addInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - addInstanceNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceNetworkInterfaceOptions model + getInstanceNetworkInterfaceOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceOptions) + getInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + getInstanceNetworkInterfaceOptionsModel.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.AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr := vpcService.GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptionsModel) 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 AddInstanceNetworkInterfaceFloatingIPOptions model with no property values - addInstanceNetworkInterfaceFloatingIPOptionsModelNew := new(vpcv1.AddInstanceNetworkInterfaceFloatingIPOptions) + // Construct a second instance of the GetInstanceNetworkInterfaceOptions model with no property values + getInstanceNetworkInterfaceOptionsModelNew := new(vpcv1.GetInstanceNetworkInterfaceOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptionsModelNew) + result, response, operationErr = vpcService.GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -25410,10 +25991,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke AddInstanceNetworkInterfaceFloatingIP successfully`, func() { + It(`Invoke GetInstanceNetworkInterface successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -25422,15 +26003,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the AddInstanceNetworkInterfaceFloatingIPOptions model - addInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddInstanceNetworkInterfaceFloatingIPOptions) - addInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") - addInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - addInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - addInstanceNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceNetworkInterfaceOptions model + getInstanceNetworkInterfaceOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceOptions) + getInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + getInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr := vpcService.GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -25442,27 +26022,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) - Operation response error`, func() { + Describe(`UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions) - Operation response error`, func() { version := "testString" - listInstanceNetworkInterfaceIpsPath := "/instances/testString/network_interfaces/testString/ips" + updateInstanceNetworkInterfacePath := "/instances/testString/network_interfaces/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(listInstanceNetworkInterfaceIpsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceNetworkInterfacePath)) + 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))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListInstanceNetworkInterfaceIps with error: Operation response processing error`, func() { + It(`Invoke UpdateInstanceNetworkInterface with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -25471,22 +26049,28 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceNetworkInterfaceIpsOptions model - listInstanceNetworkInterfaceIpsOptionsModel := new(vpcv1.ListInstanceNetworkInterfaceIpsOptions) - listInstanceNetworkInterfaceIpsOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceNetworkInterfaceIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - listInstanceNetworkInterfaceIpsOptionsModel.Start = core.StringPtr("testString") - listInstanceNetworkInterfaceIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the NetworkInterfacePatch model + networkInterfacePatchModel := new(vpcv1.NetworkInterfacePatch) + networkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) + networkInterfacePatchModel.Name = core.StringPtr("my-network-interface-1") + networkInterfacePatchModelAsPatch, asPatchErr := networkInterfacePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateInstanceNetworkInterfaceOptions model + updateInstanceNetworkInterfaceOptionsModel := new(vpcv1.UpdateInstanceNetworkInterfaceOptions) + updateInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") + updateInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + updateInstanceNetworkInterfaceOptionsModel.NetworkInterfacePatch = networkInterfacePatchModelAsPatch + updateInstanceNetworkInterfaceOptionsModel.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.ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptionsModel) 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.ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptionsModel) + result, response, operationErr = vpcService.UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -25496,32 +26080,46 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions)`, func() { + Describe(`UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions)`, func() { version := "testString" - listInstanceNetworkInterfaceIpsPath := "/instances/testString/network_interfaces/testString/ips" + updateInstanceNetworkInterfacePath := "/instances/testString/network_interfaces/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(listInstanceNetworkInterfaceIpsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceNetworkInterfacePath)) + 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))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) // 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:r134-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/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-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}`) + fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "network_interface", "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"}], "status": "available", "subnet": {"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"}, "type": "primary"}`) })) }) - It(`Invoke ListInstanceNetworkInterfaceIps successfully with retries`, func() { + It(`Invoke UpdateInstanceNetworkInterface successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -25531,24 +26129,30 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListInstanceNetworkInterfaceIpsOptions model - listInstanceNetworkInterfaceIpsOptionsModel := new(vpcv1.ListInstanceNetworkInterfaceIpsOptions) - listInstanceNetworkInterfaceIpsOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceNetworkInterfaceIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - listInstanceNetworkInterfaceIpsOptionsModel.Start = core.StringPtr("testString") - listInstanceNetworkInterfaceIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the NetworkInterfacePatch model + networkInterfacePatchModel := new(vpcv1.NetworkInterfacePatch) + networkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) + networkInterfacePatchModel.Name = core.StringPtr("my-network-interface-1") + networkInterfacePatchModelAsPatch, asPatchErr := networkInterfacePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateInstanceNetworkInterfaceOptions model + updateInstanceNetworkInterfaceOptionsModel := new(vpcv1.UpdateInstanceNetworkInterfaceOptions) + updateInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") + updateInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + updateInstanceNetworkInterfaceOptionsModel.NetworkInterfacePatch = networkInterfacePatchModelAsPatch + updateInstanceNetworkInterfaceOptionsModel.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.ListInstanceNetworkInterfaceIpsWithContext(ctx, listInstanceNetworkInterfaceIpsOptionsModel) + _, _, operationErr := vpcService.UpdateInstanceNetworkInterfaceWithContext(ctx, updateInstanceNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -25556,7 +26160,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListInstanceNetworkInterfaceIpsWithContext(ctx, listInstanceNetworkInterfaceIpsOptionsModel) + _, _, operationErr = vpcService.UpdateInstanceNetworkInterfaceWithContext(ctx, updateInstanceNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -25570,20 +26174,34 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceNetworkInterfaceIpsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceNetworkInterfacePath)) + 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))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + // 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", `{"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:r134-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/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-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}`) + fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "network_interface", "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"}], "status": "available", "subnet": {"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"}, "type": "primary"}`) })) }) - It(`Invoke ListInstanceNetworkInterfaceIps successfully`, func() { + It(`Invoke UpdateInstanceNetworkInterface successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -25593,27 +26211,33 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListInstanceNetworkInterfaceIps(nil) + result, response, operationErr := vpcService.UpdateInstanceNetworkInterface(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListInstanceNetworkInterfaceIpsOptions model - listInstanceNetworkInterfaceIpsOptionsModel := new(vpcv1.ListInstanceNetworkInterfaceIpsOptions) - listInstanceNetworkInterfaceIpsOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceNetworkInterfaceIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - listInstanceNetworkInterfaceIpsOptionsModel.Start = core.StringPtr("testString") - listInstanceNetworkInterfaceIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the NetworkInterfacePatch model + networkInterfacePatchModel := new(vpcv1.NetworkInterfacePatch) + networkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) + networkInterfacePatchModel.Name = core.StringPtr("my-network-interface-1") + networkInterfacePatchModelAsPatch, asPatchErr := networkInterfacePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateInstanceNetworkInterfaceOptions model + updateInstanceNetworkInterfaceOptionsModel := new(vpcv1.UpdateInstanceNetworkInterfaceOptions) + updateInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") + updateInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + updateInstanceNetworkInterfaceOptionsModel.NetworkInterfacePatch = networkInterfacePatchModelAsPatch + updateInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptionsModel) + result, response, operationErr = vpcService.UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListInstanceNetworkInterfaceIps with error: Operation validation and request error`, func() { + It(`Invoke UpdateInstanceNetworkInterface with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -25622,25 +26246,31 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceNetworkInterfaceIpsOptions model - listInstanceNetworkInterfaceIpsOptionsModel := new(vpcv1.ListInstanceNetworkInterfaceIpsOptions) - listInstanceNetworkInterfaceIpsOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceNetworkInterfaceIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - listInstanceNetworkInterfaceIpsOptionsModel.Start = core.StringPtr("testString") - listInstanceNetworkInterfaceIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the NetworkInterfacePatch model + networkInterfacePatchModel := new(vpcv1.NetworkInterfacePatch) + networkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) + networkInterfacePatchModel.Name = core.StringPtr("my-network-interface-1") + networkInterfacePatchModelAsPatch, asPatchErr := networkInterfacePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateInstanceNetworkInterfaceOptions model + updateInstanceNetworkInterfaceOptionsModel := new(vpcv1.UpdateInstanceNetworkInterfaceOptions) + updateInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") + updateInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + updateInstanceNetworkInterfaceOptionsModel.NetworkInterfacePatch = networkInterfacePatchModelAsPatch + updateInstanceNetworkInterfaceOptionsModel.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.ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptionsModel) 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 ListInstanceNetworkInterfaceIpsOptions model with no property values - listInstanceNetworkInterfaceIpsOptionsModelNew := new(vpcv1.ListInstanceNetworkInterfaceIpsOptions) + // Construct a second instance of the UpdateInstanceNetworkInterfaceOptions model with no property values + updateInstanceNetworkInterfaceOptionsModelNew := new(vpcv1.UpdateInstanceNetworkInterfaceOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptionsModelNew) + result, response, operationErr = vpcService.UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -25658,7 +26288,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListInstanceNetworkInterfaceIps successfully`, func() { + It(`Invoke UpdateInstanceNetworkInterface successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -25667,16 +26297,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceNetworkInterfaceIpsOptions model - listInstanceNetworkInterfaceIpsOptionsModel := new(vpcv1.ListInstanceNetworkInterfaceIpsOptions) - listInstanceNetworkInterfaceIpsOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceNetworkInterfaceIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - listInstanceNetworkInterfaceIpsOptionsModel.Start = core.StringPtr("testString") - listInstanceNetworkInterfaceIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the NetworkInterfacePatch model + networkInterfacePatchModel := new(vpcv1.NetworkInterfacePatch) + networkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) + networkInterfacePatchModel.Name = core.StringPtr("my-network-interface-1") + networkInterfacePatchModelAsPatch, asPatchErr := networkInterfacePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateInstanceNetworkInterfaceOptions model + updateInstanceNetworkInterfaceOptionsModel := new(vpcv1.UpdateInstanceNetworkInterfaceOptions) + updateInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") + updateInstanceNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + updateInstanceNetworkInterfaceOptionsModel.NetworkInterfacePatch = networkInterfacePatchModelAsPatch + updateInstanceNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -25687,122 +26323,17 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) - Context(`Test pagination helper method on response`, func() { - It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.ReservedIPCollectionInstanceNetworkInterfaceContext) - nextObject := new(vpcv1.ReservedIPCollectionInstanceNetworkInterfaceContextNext) - 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.ReservedIPCollectionInstanceNetworkInterfaceContext) - - 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.ReservedIPCollectionInstanceNetworkInterfaceContext) - nextObject := new(vpcv1.ReservedIPCollectionInstanceNetworkInterfaceContextNext) - nextObject.Href = core.StringPtr("ibm.com") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - }) - Context(`Using mock server endpoint - paginated response`, func() { - BeforeEach(func() { - var requestNumber int = 0 - 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(listInstanceNetworkInterfaceIpsPath)) - Expect(req.Method).To(Equal("GET")) - - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - requestNumber++ - if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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:r134-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/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5","id":"r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5","name":"my-endpoint-gateway","resource_type":"endpoint_gateway"}}]}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"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:r134-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/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5","id":"r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5","name":"my-endpoint-gateway","resource_type":"endpoint_gateway"}}]}`) - } else { - res.WriteHeader(400) - } - })) - }) - It(`Use InstanceNetworkInterfaceIpsPager.GetNext 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()) - - listInstanceNetworkInterfaceIpsOptionsModel := &vpcv1.ListInstanceNetworkInterfaceIpsOptions{ - InstanceID: core.StringPtr("testString"), - NetworkInterfaceID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewInstanceNetworkInterfaceIpsPager(listInstanceNetworkInterfaceIpsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.ReservedIP - for pager.HasNext() { - nextPage, err := pager.GetNext() - Expect(err).To(BeNil()) - Expect(nextPage).ToNot(BeNil()) - allResults = append(allResults, nextPage...) - } - Expect(len(allResults)).To(Equal(2)) - }) - It(`Use InstanceNetworkInterfaceIpsPager.GetAll 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()) - - listInstanceNetworkInterfaceIpsOptionsModel := &vpcv1.ListInstanceNetworkInterfaceIpsOptions{ - InstanceID: core.StringPtr("testString"), - NetworkInterfaceID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewInstanceNetworkInterfaceIpsPager(listInstanceNetworkInterfaceIpsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - allResults, err := pager.GetAll() - Expect(err).To(BeNil()) - Expect(allResults).ToNot(BeNil()) - Expect(len(allResults)).To(Equal(2)) - }) - }) }) - Describe(`GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptions *GetInstanceNetworkInterfaceIPOptions) - Operation response error`, func() { + Describe(`ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions) - Operation response error`, func() { version := "testString" - getInstanceNetworkInterfaceIPPath := "/instances/testString/network_interfaces/testString/ips/testString" + listInstanceNetworkInterfaceFloatingIpsPath := "/instances/testString/network_interfaces/testString/floating_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(getInstanceNetworkInterfaceIPPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceNetworkInterfaceFloatingIpsPath)) 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))})) @@ -25811,7 +26342,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetInstanceNetworkInterfaceIP with error: Operation response processing error`, func() { + It(`Invoke ListInstanceNetworkInterfaceFloatingIps with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -25820,21 +26351,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceNetworkInterfaceIPOptions model - getInstanceNetworkInterfaceIPOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceIPOptions) - getInstanceNetworkInterfaceIPOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceNetworkInterfaceIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - getInstanceNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") - getInstanceNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceNetworkInterfaceFloatingIpsOptions model + listInstanceNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListInstanceNetworkInterfaceFloatingIpsOptions) + listInstanceNetworkInterfaceFloatingIpsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + listInstanceNetworkInterfaceFloatingIpsOptionsModel.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.GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptionsModel) + result, response, operationErr := vpcService.ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptionsModel) 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.GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptionsModel) + result, response, operationErr = vpcService.ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -25844,16 +26374,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptions *GetInstanceNetworkInterfaceIPOptions)`, func() { + Describe(`ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions)`, func() { version := "testString" - getInstanceNetworkInterfaceIPPath := "/instances/testString/network_interfaces/testString/ips/testString" + listInstanceNetworkInterfaceFloatingIpsPath := "/instances/testString/network_interfaces/testString/floating_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(getInstanceNetworkInterfaceIPPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceNetworkInterfaceFloatingIpsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -25864,10 +26394,10 @@ var _ = Describe(`VpcV1`, func() { // 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:r134-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/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}`) + fmt.Fprintf(res, "%s", `{"floating_ips": [{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}]}`) })) }) - It(`Invoke GetInstanceNetworkInterfaceIP successfully with retries`, func() { + It(`Invoke ListInstanceNetworkInterfaceFloatingIps successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -25877,23 +26407,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetInstanceNetworkInterfaceIPOptions model - getInstanceNetworkInterfaceIPOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceIPOptions) - getInstanceNetworkInterfaceIPOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceNetworkInterfaceIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - getInstanceNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") - getInstanceNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceNetworkInterfaceFloatingIpsOptions model + listInstanceNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListInstanceNetworkInterfaceFloatingIpsOptions) + listInstanceNetworkInterfaceFloatingIpsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + listInstanceNetworkInterfaceFloatingIpsOptionsModel.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.GetInstanceNetworkInterfaceIPWithContext(ctx, getInstanceNetworkInterfaceIPOptionsModel) + _, _, operationErr := vpcService.ListInstanceNetworkInterfaceFloatingIpsWithContext(ctx, listInstanceNetworkInterfaceFloatingIpsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptionsModel) + result, response, operationErr := vpcService.ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -25901,7 +26430,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetInstanceNetworkInterfaceIPWithContext(ctx, getInstanceNetworkInterfaceIPOptionsModel) + _, _, operationErr = vpcService.ListInstanceNetworkInterfaceFloatingIpsWithContext(ctx, listInstanceNetworkInterfaceFloatingIpsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -25915,7 +26444,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInstanceNetworkInterfaceIPPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceNetworkInterfaceFloatingIpsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -25923,10 +26452,10 @@ var _ = Describe(`VpcV1`, func() { // 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:r134-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/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}`) + fmt.Fprintf(res, "%s", `{"floating_ips": [{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}]}`) })) }) - It(`Invoke GetInstanceNetworkInterfaceIP successfully`, func() { + It(`Invoke ListInstanceNetworkInterfaceFloatingIps successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -25936,26 +26465,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetInstanceNetworkInterfaceIP(nil) + result, response, operationErr := vpcService.ListInstanceNetworkInterfaceFloatingIps(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetInstanceNetworkInterfaceIPOptions model - getInstanceNetworkInterfaceIPOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceIPOptions) - getInstanceNetworkInterfaceIPOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceNetworkInterfaceIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - getInstanceNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") - getInstanceNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceNetworkInterfaceFloatingIpsOptions model + listInstanceNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListInstanceNetworkInterfaceFloatingIpsOptions) + listInstanceNetworkInterfaceFloatingIpsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + listInstanceNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptionsModel) + result, response, operationErr = vpcService.ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetInstanceNetworkInterfaceIP with error: Operation validation and request error`, func() { + It(`Invoke ListInstanceNetworkInterfaceFloatingIps with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -25964,24 +26492,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceNetworkInterfaceIPOptions model - getInstanceNetworkInterfaceIPOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceIPOptions) - getInstanceNetworkInterfaceIPOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceNetworkInterfaceIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - getInstanceNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") - getInstanceNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceNetworkInterfaceFloatingIpsOptions model + listInstanceNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListInstanceNetworkInterfaceFloatingIpsOptions) + listInstanceNetworkInterfaceFloatingIpsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + listInstanceNetworkInterfaceFloatingIpsOptionsModel.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.GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptionsModel) + result, response, operationErr := vpcService.ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptionsModel) 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 GetInstanceNetworkInterfaceIPOptions model with no property values - getInstanceNetworkInterfaceIPOptionsModelNew := new(vpcv1.GetInstanceNetworkInterfaceIPOptions) + // Construct a second instance of the ListInstanceNetworkInterfaceFloatingIpsOptions model with no property values + listInstanceNetworkInterfaceFloatingIpsOptionsModelNew := new(vpcv1.ListInstanceNetworkInterfaceFloatingIpsOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptionsModelNew) + result, response, operationErr = vpcService.ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -25999,7 +26526,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetInstanceNetworkInterfaceIP successfully`, func() { + It(`Invoke ListInstanceNetworkInterfaceFloatingIps successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -26008,15 +26535,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceNetworkInterfaceIPOptions model - getInstanceNetworkInterfaceIPOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceIPOptions) - getInstanceNetworkInterfaceIPOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceNetworkInterfaceIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - getInstanceNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") - getInstanceNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceNetworkInterfaceFloatingIpsOptions model + listInstanceNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListInstanceNetworkInterfaceFloatingIpsOptions) + listInstanceNetworkInterfaceFloatingIpsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + listInstanceNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptionsModel) + result, response, operationErr := vpcService.ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -26028,16 +26554,93 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptions *ListInstanceVolumeAttachmentsOptions) - Operation response error`, func() { + Describe(`RemoveInstanceNetworkInterfaceFloatingIP(removeInstanceNetworkInterfaceFloatingIPOptions *RemoveInstanceNetworkInterfaceFloatingIPOptions)`, func() { version := "testString" - listInstanceVolumeAttachmentsPath := "/instances/testString/volume_attachments" + removeInstanceNetworkInterfaceFloatingIPPath := "/instances/testString/network_interfaces/testString/floating_ips/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(removeInstanceNetworkInterfaceFloatingIPPath)) + 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(204) + })) + }) + It(`Invoke RemoveInstanceNetworkInterfaceFloatingIP 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.RemoveInstanceNetworkInterfaceFloatingIP(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the RemoveInstanceNetworkInterfaceFloatingIPOptions model + removeInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.RemoveInstanceNetworkInterfaceFloatingIPOptions) + removeInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") + removeInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + removeInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + removeInstanceNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.RemoveInstanceNetworkInterfaceFloatingIP(removeInstanceNetworkInterfaceFloatingIPOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke RemoveInstanceNetworkInterfaceFloatingIP 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 RemoveInstanceNetworkInterfaceFloatingIPOptions model + removeInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.RemoveInstanceNetworkInterfaceFloatingIPOptions) + removeInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") + removeInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + removeInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + removeInstanceNetworkInterfaceFloatingIPOptionsModel.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.RemoveInstanceNetworkInterfaceFloatingIP(removeInstanceNetworkInterfaceFloatingIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the RemoveInstanceNetworkInterfaceFloatingIPOptions model with no property values + removeInstanceNetworkInterfaceFloatingIPOptionsModelNew := new(vpcv1.RemoveInstanceNetworkInterfaceFloatingIPOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.RemoveInstanceNetworkInterfaceFloatingIP(removeInstanceNetworkInterfaceFloatingIPOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptions *GetInstanceNetworkInterfaceFloatingIPOptions) - Operation response error`, func() { + version := "testString" + getInstanceNetworkInterfaceFloatingIPPath := "/instances/testString/network_interfaces/testString/floating_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(listInstanceVolumeAttachmentsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceNetworkInterfaceFloatingIPPath)) 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))})) @@ -26046,7 +26649,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListInstanceVolumeAttachments with error: Operation response processing error`, func() { + It(`Invoke GetInstanceNetworkInterfaceFloatingIP with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -26055,19 +26658,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceVolumeAttachmentsOptions model - listInstanceVolumeAttachmentsOptionsModel := new(vpcv1.ListInstanceVolumeAttachmentsOptions) - listInstanceVolumeAttachmentsOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceVolumeAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceNetworkInterfaceFloatingIPOptions model + getInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceFloatingIPOptions) + getInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + getInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + getInstanceNetworkInterfaceFloatingIPOptionsModel.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.ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptionsModel) + result, response, operationErr := vpcService.GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptionsModel) 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.ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptionsModel) + result, response, operationErr = vpcService.GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -26077,16 +26682,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptions *ListInstanceVolumeAttachmentsOptions)`, func() { + Describe(`GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptions *GetInstanceNetworkInterfaceFloatingIPOptions)`, func() { version := "testString" - listInstanceVolumeAttachmentsPath := "/instances/testString/volume_attachments" + getInstanceNetworkInterfaceFloatingIPPath := "/instances/testString/network_interfaces/testString/floating_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(listInstanceVolumeAttachmentsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceNetworkInterfaceFloatingIPPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -26097,10 +26702,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"volume_attachments": [{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}]}`) + fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke ListInstanceVolumeAttachments successfully with retries`, func() { + It(`Invoke GetInstanceNetworkInterfaceFloatingIP successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -26110,21 +26715,23 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListInstanceVolumeAttachmentsOptions model - listInstanceVolumeAttachmentsOptionsModel := new(vpcv1.ListInstanceVolumeAttachmentsOptions) - listInstanceVolumeAttachmentsOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceVolumeAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceNetworkInterfaceFloatingIPOptions model + getInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceFloatingIPOptions) + getInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + getInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + getInstanceNetworkInterfaceFloatingIPOptionsModel.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.ListInstanceVolumeAttachmentsWithContext(ctx, listInstanceVolumeAttachmentsOptionsModel) + _, _, operationErr := vpcService.GetInstanceNetworkInterfaceFloatingIPWithContext(ctx, getInstanceNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptionsModel) + result, response, operationErr := vpcService.GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -26132,7 +26739,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListInstanceVolumeAttachmentsWithContext(ctx, listInstanceVolumeAttachmentsOptionsModel) + _, _, operationErr = vpcService.GetInstanceNetworkInterfaceFloatingIPWithContext(ctx, getInstanceNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -26146,7 +26753,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceVolumeAttachmentsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceNetworkInterfaceFloatingIPPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -26154,10 +26761,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"volume_attachments": [{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}]}`) + fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke ListInstanceVolumeAttachments successfully`, func() { + It(`Invoke GetInstanceNetworkInterfaceFloatingIP successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -26167,24 +26774,26 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListInstanceVolumeAttachments(nil) + result, response, operationErr := vpcService.GetInstanceNetworkInterfaceFloatingIP(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListInstanceVolumeAttachmentsOptions model - listInstanceVolumeAttachmentsOptionsModel := new(vpcv1.ListInstanceVolumeAttachmentsOptions) - listInstanceVolumeAttachmentsOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceVolumeAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceNetworkInterfaceFloatingIPOptions model + getInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceFloatingIPOptions) + getInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + getInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + getInstanceNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptionsModel) + result, response, operationErr = vpcService.GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListInstanceVolumeAttachments with error: Operation validation and request error`, func() { + It(`Invoke GetInstanceNetworkInterfaceFloatingIP with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -26193,22 +26802,24 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceVolumeAttachmentsOptions model - listInstanceVolumeAttachmentsOptionsModel := new(vpcv1.ListInstanceVolumeAttachmentsOptions) - listInstanceVolumeAttachmentsOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceVolumeAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceNetworkInterfaceFloatingIPOptions model + getInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceFloatingIPOptions) + getInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + getInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + getInstanceNetworkInterfaceFloatingIPOptionsModel.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.ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptionsModel) + result, response, operationErr := vpcService.GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptionsModel) 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 ListInstanceVolumeAttachmentsOptions model with no property values - listInstanceVolumeAttachmentsOptionsModelNew := new(vpcv1.ListInstanceVolumeAttachmentsOptions) + // Construct a second instance of the GetInstanceNetworkInterfaceFloatingIPOptions model with no property values + getInstanceNetworkInterfaceFloatingIPOptionsModelNew := new(vpcv1.GetInstanceNetworkInterfaceFloatingIPOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptionsModelNew) + result, response, operationErr = vpcService.GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -26226,7 +26837,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListInstanceVolumeAttachments successfully`, func() { + It(`Invoke GetInstanceNetworkInterfaceFloatingIP successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -26235,13 +26846,15 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceVolumeAttachmentsOptions model - listInstanceVolumeAttachmentsOptionsModel := new(vpcv1.ListInstanceVolumeAttachmentsOptions) - listInstanceVolumeAttachmentsOptionsModel.InstanceID = core.StringPtr("testString") - listInstanceVolumeAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceNetworkInterfaceFloatingIPOptions model + getInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceFloatingIPOptions) + getInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + getInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + getInstanceNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptionsModel) + result, response, operationErr := vpcService.GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -26253,17 +26866,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptions *CreateInstanceVolumeAttachmentOptions) - Operation response error`, func() { + Describe(`AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptions *AddInstanceNetworkInterfaceFloatingIPOptions) - Operation response error`, func() { version := "testString" - createInstanceVolumeAttachmentPath := "/instances/testString/volume_attachments" + addInstanceNetworkInterfaceFloatingIPPath := "/instances/testString/network_interfaces/testString/floating_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(createInstanceVolumeAttachmentPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(addInstanceNetworkInterfaceFloatingIPPath)) + Expect(req.Method).To(Equal("PUT")) 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") @@ -26271,7 +26884,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateInstanceVolumeAttachment with error: Operation response processing error`, func() { + It(`Invoke AddInstanceNetworkInterfaceFloatingIP with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -26280,26 +26893,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID model - volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) - volumeAttachmentPrototypeVolumeModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - - // Construct an instance of the CreateInstanceVolumeAttachmentOptions model - createInstanceVolumeAttachmentOptionsModel := new(vpcv1.CreateInstanceVolumeAttachmentOptions) - createInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - createInstanceVolumeAttachmentOptionsModel.Volume = volumeAttachmentPrototypeVolumeModel - createInstanceVolumeAttachmentOptionsModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) - createInstanceVolumeAttachmentOptionsModel.Name = core.StringPtr("my-volume-attachment") - createInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddInstanceNetworkInterfaceFloatingIPOptions model + addInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddInstanceNetworkInterfaceFloatingIPOptions) + addInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") + addInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + addInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + addInstanceNetworkInterfaceFloatingIPOptionsModel.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.CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptionsModel) + result, response, operationErr := vpcService.AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptionsModel) 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.CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptionsModel) + result, response, operationErr = vpcService.AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -26309,33 +26917,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptions *CreateInstanceVolumeAttachmentOptions)`, func() { + Describe(`AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptions *AddInstanceNetworkInterfaceFloatingIPOptions)`, func() { version := "testString" - createInstanceVolumeAttachmentPath := "/instances/testString/volume_attachments" + addInstanceNetworkInterfaceFloatingIPPath := "/instances/testString/network_interfaces/testString/floating_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(createInstanceVolumeAttachmentPath)) - 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.EscapedPath()).To(Equal(addInstanceNetworkInterfaceFloatingIPPath)) + Expect(req.Method).To(Equal("PUT")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -26345,10 +26937,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}`) + fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke CreateInstanceVolumeAttachment successfully with retries`, func() { + It(`Invoke AddInstanceNetworkInterfaceFloatingIP successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -26358,28 +26950,23 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID model - volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) - volumeAttachmentPrototypeVolumeModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - - // Construct an instance of the CreateInstanceVolumeAttachmentOptions model - createInstanceVolumeAttachmentOptionsModel := new(vpcv1.CreateInstanceVolumeAttachmentOptions) - createInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - createInstanceVolumeAttachmentOptionsModel.Volume = volumeAttachmentPrototypeVolumeModel - createInstanceVolumeAttachmentOptionsModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) - createInstanceVolumeAttachmentOptionsModel.Name = core.StringPtr("my-volume-attachment") - createInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddInstanceNetworkInterfaceFloatingIPOptions model + addInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddInstanceNetworkInterfaceFloatingIPOptions) + addInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") + addInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + addInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + addInstanceNetworkInterfaceFloatingIPOptionsModel.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.CreateInstanceVolumeAttachmentWithContext(ctx, createInstanceVolumeAttachmentOptionsModel) + _, _, operationErr := vpcService.AddInstanceNetworkInterfaceFloatingIPWithContext(ctx, addInstanceNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptionsModel) + result, response, operationErr := vpcService.AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -26387,7 +26974,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreateInstanceVolumeAttachmentWithContext(ctx, createInstanceVolumeAttachmentOptionsModel) + _, _, operationErr = vpcService.AddInstanceNetworkInterfaceFloatingIPWithContext(ctx, addInstanceNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -26401,34 +26988,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createInstanceVolumeAttachmentPath)) - 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.EscapedPath()).To(Equal(addInstanceNetworkInterfaceFloatingIPPath)) + Expect(req.Method).To(Equal("PUT")) 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", `{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}`) + fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke CreateInstanceVolumeAttachment successfully`, func() { + It(`Invoke AddInstanceNetworkInterfaceFloatingIP successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -26438,31 +27009,26 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreateInstanceVolumeAttachment(nil) + result, response, operationErr := vpcService.AddInstanceNetworkInterfaceFloatingIP(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID model - volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) - volumeAttachmentPrototypeVolumeModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - - // Construct an instance of the CreateInstanceVolumeAttachmentOptions model - createInstanceVolumeAttachmentOptionsModel := new(vpcv1.CreateInstanceVolumeAttachmentOptions) - createInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - createInstanceVolumeAttachmentOptionsModel.Volume = volumeAttachmentPrototypeVolumeModel - createInstanceVolumeAttachmentOptionsModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) - createInstanceVolumeAttachmentOptionsModel.Name = core.StringPtr("my-volume-attachment") - createInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddInstanceNetworkInterfaceFloatingIPOptions model + addInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddInstanceNetworkInterfaceFloatingIPOptions) + addInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") + addInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + addInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + addInstanceNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptionsModel) + result, response, operationErr = vpcService.AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateInstanceVolumeAttachment with error: Operation validation and request error`, func() { + It(`Invoke AddInstanceNetworkInterfaceFloatingIP with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -26471,29 +27037,24 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID model - volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) - volumeAttachmentPrototypeVolumeModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - - // Construct an instance of the CreateInstanceVolumeAttachmentOptions model - createInstanceVolumeAttachmentOptionsModel := new(vpcv1.CreateInstanceVolumeAttachmentOptions) - createInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - createInstanceVolumeAttachmentOptionsModel.Volume = volumeAttachmentPrototypeVolumeModel - createInstanceVolumeAttachmentOptionsModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) - createInstanceVolumeAttachmentOptionsModel.Name = core.StringPtr("my-volume-attachment") - createInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddInstanceNetworkInterfaceFloatingIPOptions model + addInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddInstanceNetworkInterfaceFloatingIPOptions) + addInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") + addInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + addInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + addInstanceNetworkInterfaceFloatingIPOptionsModel.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.CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptionsModel) + result, response, operationErr := vpcService.AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptionsModel) 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 CreateInstanceVolumeAttachmentOptions model with no property values - createInstanceVolumeAttachmentOptionsModelNew := new(vpcv1.CreateInstanceVolumeAttachmentOptions) + // Construct a second instance of the AddInstanceNetworkInterfaceFloatingIPOptions model with no property values + addInstanceNetworkInterfaceFloatingIPOptionsModelNew := new(vpcv1.AddInstanceNetworkInterfaceFloatingIPOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptionsModelNew) + result, response, operationErr = vpcService.AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -26511,7 +27072,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(201) })) }) - It(`Invoke CreateInstanceVolumeAttachment successfully`, func() { + It(`Invoke AddInstanceNetworkInterfaceFloatingIP successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -26520,20 +27081,15 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID model - volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) - volumeAttachmentPrototypeVolumeModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - - // Construct an instance of the CreateInstanceVolumeAttachmentOptions model - createInstanceVolumeAttachmentOptionsModel := new(vpcv1.CreateInstanceVolumeAttachmentOptions) - createInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - createInstanceVolumeAttachmentOptionsModel.Volume = volumeAttachmentPrototypeVolumeModel - createInstanceVolumeAttachmentOptionsModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) - createInstanceVolumeAttachmentOptionsModel.Name = core.StringPtr("my-volume-attachment") - createInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddInstanceNetworkInterfaceFloatingIPOptions model + addInstanceNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddInstanceNetworkInterfaceFloatingIPOptions) + addInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID = core.StringPtr("testString") + addInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + addInstanceNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + addInstanceNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptionsModel) + result, response, operationErr := vpcService.AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -26545,100 +27101,27 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteInstanceVolumeAttachment(deleteInstanceVolumeAttachmentOptions *DeleteInstanceVolumeAttachmentOptions)`, func() { - version := "testString" - deleteInstanceVolumeAttachmentPath := "/instances/testString/volume_attachments/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(deleteInstanceVolumeAttachmentPath)) - 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(204) - })) - }) - It(`Invoke DeleteInstanceVolumeAttachment 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.DeleteInstanceVolumeAttachment(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteInstanceVolumeAttachmentOptions model - deleteInstanceVolumeAttachmentOptionsModel := new(vpcv1.DeleteInstanceVolumeAttachmentOptions) - deleteInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - deleteInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") - deleteInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteInstanceVolumeAttachment(deleteInstanceVolumeAttachmentOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteInstanceVolumeAttachment 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 DeleteInstanceVolumeAttachmentOptions model - deleteInstanceVolumeAttachmentOptionsModel := new(vpcv1.DeleteInstanceVolumeAttachmentOptions) - deleteInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - deleteInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") - deleteInstanceVolumeAttachmentOptionsModel.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.DeleteInstanceVolumeAttachment(deleteInstanceVolumeAttachmentOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteInstanceVolumeAttachmentOptions model with no property values - deleteInstanceVolumeAttachmentOptionsModelNew := new(vpcv1.DeleteInstanceVolumeAttachmentOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteInstanceVolumeAttachment(deleteInstanceVolumeAttachmentOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptions *GetInstanceVolumeAttachmentOptions) - Operation response error`, func() { + Describe(`ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) - Operation response error`, func() { version := "testString" - getInstanceVolumeAttachmentPath := "/instances/testString/volume_attachments/testString" + listInstanceNetworkInterfaceIpsPath := "/instances/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(getInstanceVolumeAttachmentPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceNetworkInterfaceIpsPath)) 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(10))})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetInstanceVolumeAttachment with error: Operation response processing error`, func() { + It(`Invoke ListInstanceNetworkInterfaceIps with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -26647,20 +27130,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceVolumeAttachmentOptions model - getInstanceVolumeAttachmentOptionsModel := new(vpcv1.GetInstanceVolumeAttachmentOptions) - getInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") - getInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceNetworkInterfaceIpsOptions model + listInstanceNetworkInterfaceIpsOptionsModel := new(vpcv1.ListInstanceNetworkInterfaceIpsOptions) + listInstanceNetworkInterfaceIpsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceNetworkInterfaceIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + listInstanceNetworkInterfaceIpsOptionsModel.Start = core.StringPtr("testString") + listInstanceNetworkInterfaceIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceNetworkInterfaceIpsOptionsModel.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.GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptionsModel) + result, response, operationErr := vpcService.ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptionsModel) 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.GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptionsModel) + result, response, operationErr = vpcService.ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -26670,30 +27155,32 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptions *GetInstanceVolumeAttachmentOptions)`, func() { + Describe(`ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions)`, func() { version := "testString" - getInstanceVolumeAttachmentPath := "/instances/testString/volume_attachments/testString" + listInstanceNetworkInterfaceIpsPath := "/instances/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(getInstanceVolumeAttachmentPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceNetworkInterfaceIpsPath)) 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(10))})) // 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", `{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}`) + 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:r134-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/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-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 GetInstanceVolumeAttachment successfully with retries`, func() { + It(`Invoke ListInstanceNetworkInterfaceIps successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -26703,22 +27190,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetInstanceVolumeAttachmentOptions model - getInstanceVolumeAttachmentOptionsModel := new(vpcv1.GetInstanceVolumeAttachmentOptions) - getInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") - getInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceNetworkInterfaceIpsOptions model + listInstanceNetworkInterfaceIpsOptionsModel := new(vpcv1.ListInstanceNetworkInterfaceIpsOptions) + listInstanceNetworkInterfaceIpsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceNetworkInterfaceIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + listInstanceNetworkInterfaceIpsOptionsModel.Start = core.StringPtr("testString") + listInstanceNetworkInterfaceIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceNetworkInterfaceIpsOptionsModel.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.GetInstanceVolumeAttachmentWithContext(ctx, getInstanceVolumeAttachmentOptionsModel) + _, _, operationErr := vpcService.ListInstanceNetworkInterfaceIpsWithContext(ctx, listInstanceNetworkInterfaceIpsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptionsModel) + result, response, operationErr := vpcService.ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -26726,7 +27215,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetInstanceVolumeAttachmentWithContext(ctx, getInstanceVolumeAttachmentOptionsModel) + _, _, operationErr = vpcService.ListInstanceNetworkInterfaceIpsWithContext(ctx, listInstanceNetworkInterfaceIpsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -26740,18 +27229,20 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInstanceVolumeAttachmentPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceNetworkInterfaceIpsPath)) 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(10))})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}`) + 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:r134-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/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-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 GetInstanceVolumeAttachment successfully`, func() { + It(`Invoke ListInstanceNetworkInterfaceIps successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -26761,25 +27252,27 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetInstanceVolumeAttachment(nil) + result, response, operationErr := vpcService.ListInstanceNetworkInterfaceIps(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetInstanceVolumeAttachmentOptions model - getInstanceVolumeAttachmentOptionsModel := new(vpcv1.GetInstanceVolumeAttachmentOptions) - getInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") - getInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceNetworkInterfaceIpsOptions model + listInstanceNetworkInterfaceIpsOptionsModel := new(vpcv1.ListInstanceNetworkInterfaceIpsOptions) + listInstanceNetworkInterfaceIpsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceNetworkInterfaceIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + listInstanceNetworkInterfaceIpsOptionsModel.Start = core.StringPtr("testString") + listInstanceNetworkInterfaceIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptionsModel) + result, response, operationErr = vpcService.ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetInstanceVolumeAttachment with error: Operation validation and request error`, func() { + It(`Invoke ListInstanceNetworkInterfaceIps with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -26788,23 +27281,25 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceVolumeAttachmentOptions model - getInstanceVolumeAttachmentOptionsModel := new(vpcv1.GetInstanceVolumeAttachmentOptions) - getInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") - getInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceNetworkInterfaceIpsOptions model + listInstanceNetworkInterfaceIpsOptionsModel := new(vpcv1.ListInstanceNetworkInterfaceIpsOptions) + listInstanceNetworkInterfaceIpsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceNetworkInterfaceIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + listInstanceNetworkInterfaceIpsOptionsModel.Start = core.StringPtr("testString") + listInstanceNetworkInterfaceIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceNetworkInterfaceIpsOptionsModel.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.GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptionsModel) + result, response, operationErr := vpcService.ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptionsModel) 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 GetInstanceVolumeAttachmentOptions model with no property values - getInstanceVolumeAttachmentOptionsModelNew := new(vpcv1.GetInstanceVolumeAttachmentOptions) + // Construct a second instance of the ListInstanceNetworkInterfaceIpsOptions model with no property values + listInstanceNetworkInterfaceIpsOptionsModelNew := new(vpcv1.ListInstanceNetworkInterfaceIpsOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptionsModelNew) + result, response, operationErr = vpcService.ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -26822,7 +27317,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetInstanceVolumeAttachment successfully`, func() { + It(`Invoke ListInstanceNetworkInterfaceIps successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -26831,14 +27326,16 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceVolumeAttachmentOptions model - getInstanceVolumeAttachmentOptionsModel := new(vpcv1.GetInstanceVolumeAttachmentOptions) - getInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - getInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") - getInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceNetworkInterfaceIpsOptions model + listInstanceNetworkInterfaceIpsOptionsModel := new(vpcv1.ListInstanceNetworkInterfaceIpsOptions) + listInstanceNetworkInterfaceIpsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceNetworkInterfaceIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + listInstanceNetworkInterfaceIpsOptionsModel.Start = core.StringPtr("testString") + listInstanceNetworkInterfaceIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptionsModel) + result, response, operationErr := vpcService.ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -26849,18 +27346,123 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(vpcv1.ReservedIPCollectionInstanceNetworkInterfaceContext) + nextObject := new(vpcv1.ReservedIPCollectionInstanceNetworkInterfaceContextNext) + 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.ReservedIPCollectionInstanceNetworkInterfaceContext) + + 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.ReservedIPCollectionInstanceNetworkInterfaceContext) + nextObject := new(vpcv1.ReservedIPCollectionInstanceNetworkInterfaceContextNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { + BeforeEach(func() { + var requestNumber int = 0 + 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(listInstanceNetworkInterfaceIpsPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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:r134-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/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5","id":"r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5","name":"my-endpoint-gateway","resource_type":"endpoint_gateway"}}]}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"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:r134-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/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5","id":"r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5","name":"my-endpoint-gateway","resource_type":"endpoint_gateway"}}]}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use InstanceNetworkInterfaceIpsPager.GetNext 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()) + + listInstanceNetworkInterfaceIpsOptionsModel := &vpcv1.ListInstanceNetworkInterfaceIpsOptions{ + InstanceID: core.StringPtr("testString"), + NetworkInterfaceID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewInstanceNetworkInterfaceIpsPager(listInstanceNetworkInterfaceIpsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.ReservedIP + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) + }) + It(`Use InstanceNetworkInterfaceIpsPager.GetAll 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()) + + listInstanceNetworkInterfaceIpsOptionsModel := &vpcv1.ListInstanceNetworkInterfaceIpsOptions{ + InstanceID: core.StringPtr("testString"), + NetworkInterfaceID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewInstanceNetworkInterfaceIpsPager(listInstanceNetworkInterfaceIpsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) + }) + }) }) - Describe(`UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptions *UpdateInstanceVolumeAttachmentOptions) - Operation response error`, func() { + Describe(`GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptions *GetInstanceNetworkInterfaceIPOptions) - Operation response error`, func() { version := "testString" - updateInstanceVolumeAttachmentPath := "/instances/testString/volume_attachments/testString" + getInstanceNetworkInterfaceIPPath := "/instances/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(updateInstanceVolumeAttachmentPath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceNetworkInterfaceIPPath)) + 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") @@ -26868,7 +27470,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateInstanceVolumeAttachment with error: Operation response processing error`, func() { + It(`Invoke GetInstanceNetworkInterfaceIP with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -26877,28 +27479,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VolumeAttachmentPatch model - volumeAttachmentPatchModel := new(vpcv1.VolumeAttachmentPatch) - volumeAttachmentPatchModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) - volumeAttachmentPatchModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPatchModelAsPatch, asPatchErr := volumeAttachmentPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateInstanceVolumeAttachmentOptions model - updateInstanceVolumeAttachmentOptionsModel := new(vpcv1.UpdateInstanceVolumeAttachmentOptions) - updateInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - updateInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") - updateInstanceVolumeAttachmentOptionsModel.VolumeAttachmentPatch = volumeAttachmentPatchModelAsPatch - updateInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceNetworkInterfaceIPOptions model + getInstanceNetworkInterfaceIPOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceIPOptions) + getInstanceNetworkInterfaceIPOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceNetworkInterfaceIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + getInstanceNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") + getInstanceNetworkInterfaceIPOptionsModel.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.UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptionsModel) + result, response, operationErr := vpcService.GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptionsModel) 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.UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptionsModel) + result, response, operationErr = vpcService.GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -26908,33 +27503,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptions *UpdateInstanceVolumeAttachmentOptions)`, func() { + Describe(`GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptions *GetInstanceNetworkInterfaceIPOptions)`, func() { version := "testString" - updateInstanceVolumeAttachmentPath := "/instances/testString/volume_attachments/testString" + getInstanceNetworkInterfaceIPPath := "/instances/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(updateInstanceVolumeAttachmentPath)) - 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.EscapedPath()).To(Equal(getInstanceNetworkInterfaceIPPath)) + 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))})) @@ -26944,10 +27523,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}`) + 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:r134-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/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}`) })) }) - It(`Invoke UpdateInstanceVolumeAttachment successfully with retries`, func() { + It(`Invoke GetInstanceNetworkInterfaceIP successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -26957,30 +27536,23 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the VolumeAttachmentPatch model - volumeAttachmentPatchModel := new(vpcv1.VolumeAttachmentPatch) - volumeAttachmentPatchModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) - volumeAttachmentPatchModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPatchModelAsPatch, asPatchErr := volumeAttachmentPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateInstanceVolumeAttachmentOptions model - updateInstanceVolumeAttachmentOptionsModel := new(vpcv1.UpdateInstanceVolumeAttachmentOptions) - updateInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - updateInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") - updateInstanceVolumeAttachmentOptionsModel.VolumeAttachmentPatch = volumeAttachmentPatchModelAsPatch - updateInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceNetworkInterfaceIPOptions model + getInstanceNetworkInterfaceIPOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceIPOptions) + getInstanceNetworkInterfaceIPOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceNetworkInterfaceIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + getInstanceNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") + getInstanceNetworkInterfaceIPOptionsModel.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.UpdateInstanceVolumeAttachmentWithContext(ctx, updateInstanceVolumeAttachmentOptionsModel) + _, _, operationErr := vpcService.GetInstanceNetworkInterfaceIPWithContext(ctx, getInstanceNetworkInterfaceIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptionsModel) + result, response, operationErr := vpcService.GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -26988,7 +27560,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateInstanceVolumeAttachmentWithContext(ctx, updateInstanceVolumeAttachmentOptionsModel) + _, _, operationErr = vpcService.GetInstanceNetworkInterfaceIPWithContext(ctx, getInstanceNetworkInterfaceIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -27002,34 +27574,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateInstanceVolumeAttachmentPath)) - 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.EscapedPath()).To(Equal(getInstanceNetworkInterfaceIPPath)) + 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", `{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}`) + 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:r134-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/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}`) })) }) - It(`Invoke UpdateInstanceVolumeAttachment successfully`, func() { + It(`Invoke GetInstanceNetworkInterfaceIP successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -27039,33 +27595,26 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateInstanceVolumeAttachment(nil) + result, response, operationErr := vpcService.GetInstanceNetworkInterfaceIP(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the VolumeAttachmentPatch model - volumeAttachmentPatchModel := new(vpcv1.VolumeAttachmentPatch) - volumeAttachmentPatchModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) - volumeAttachmentPatchModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPatchModelAsPatch, asPatchErr := volumeAttachmentPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateInstanceVolumeAttachmentOptions model - updateInstanceVolumeAttachmentOptionsModel := new(vpcv1.UpdateInstanceVolumeAttachmentOptions) - updateInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - updateInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") - updateInstanceVolumeAttachmentOptionsModel.VolumeAttachmentPatch = volumeAttachmentPatchModelAsPatch - updateInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceNetworkInterfaceIPOptions model + getInstanceNetworkInterfaceIPOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceIPOptions) + getInstanceNetworkInterfaceIPOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceNetworkInterfaceIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + getInstanceNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") + getInstanceNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptionsModel) + result, response, operationErr = vpcService.GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateInstanceVolumeAttachment with error: Operation validation and request error`, func() { + It(`Invoke GetInstanceNetworkInterfaceIP with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -27074,31 +27623,24 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VolumeAttachmentPatch model - volumeAttachmentPatchModel := new(vpcv1.VolumeAttachmentPatch) - volumeAttachmentPatchModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) - volumeAttachmentPatchModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPatchModelAsPatch, asPatchErr := volumeAttachmentPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateInstanceVolumeAttachmentOptions model - updateInstanceVolumeAttachmentOptionsModel := new(vpcv1.UpdateInstanceVolumeAttachmentOptions) - updateInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - updateInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") - updateInstanceVolumeAttachmentOptionsModel.VolumeAttachmentPatch = volumeAttachmentPatchModelAsPatch - updateInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceNetworkInterfaceIPOptions model + getInstanceNetworkInterfaceIPOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceIPOptions) + getInstanceNetworkInterfaceIPOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceNetworkInterfaceIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + getInstanceNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") + getInstanceNetworkInterfaceIPOptionsModel.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.UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptionsModel) + result, response, operationErr := vpcService.GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptionsModel) 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 UpdateInstanceVolumeAttachmentOptions model with no property values - updateInstanceVolumeAttachmentOptionsModelNew := new(vpcv1.UpdateInstanceVolumeAttachmentOptions) + // Construct a second instance of the GetInstanceNetworkInterfaceIPOptions model with no property values + getInstanceNetworkInterfaceIPOptionsModelNew := new(vpcv1.GetInstanceNetworkInterfaceIPOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptionsModelNew) + result, response, operationErr = vpcService.GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -27116,7 +27658,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateInstanceVolumeAttachment successfully`, func() { + It(`Invoke GetInstanceNetworkInterfaceIP successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -27125,22 +27667,15 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VolumeAttachmentPatch model - volumeAttachmentPatchModel := new(vpcv1.VolumeAttachmentPatch) - volumeAttachmentPatchModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) - volumeAttachmentPatchModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPatchModelAsPatch, asPatchErr := volumeAttachmentPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateInstanceVolumeAttachmentOptions model - updateInstanceVolumeAttachmentOptionsModel := new(vpcv1.UpdateInstanceVolumeAttachmentOptions) - updateInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") - updateInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") - updateInstanceVolumeAttachmentOptionsModel.VolumeAttachmentPatch = volumeAttachmentPatchModelAsPatch - updateInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceNetworkInterfaceIPOptions model + getInstanceNetworkInterfaceIPOptionsModel := new(vpcv1.GetInstanceNetworkInterfaceIPOptions) + getInstanceNetworkInterfaceIPOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceNetworkInterfaceIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + getInstanceNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") + getInstanceNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptionsModel) + result, response, operationErr := vpcService.GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -27152,27 +27687,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListInstanceGroups(listInstanceGroupsOptions *ListInstanceGroupsOptions) - Operation response error`, func() { + Describe(`ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptions *ListInstanceVolumeAttachmentsOptions) - Operation response error`, func() { version := "testString" - listInstanceGroupsPath := "/instance_groups" + listInstanceVolumeAttachmentsPath := "/instances/testString/volume_attachments" 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(listInstanceGroupsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceVolumeAttachmentsPath)) 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(10))})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListInstanceGroups with error: Operation response processing error`, func() { + It(`Invoke ListInstanceVolumeAttachments with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -27181,20 +27714,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceGroupsOptions model - listInstanceGroupsOptionsModel := new(vpcv1.ListInstanceGroupsOptions) - listInstanceGroupsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceVolumeAttachmentsOptions model + listInstanceVolumeAttachmentsOptionsModel := new(vpcv1.ListInstanceVolumeAttachmentsOptions) + listInstanceVolumeAttachmentsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceVolumeAttachmentsOptionsModel.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.ListInstanceGroups(listInstanceGroupsOptionsModel) + result, response, operationErr := vpcService.ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptionsModel) 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.ListInstanceGroups(listInstanceGroupsOptionsModel) + result, response, operationErr = vpcService.ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -27204,32 +27736,30 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListInstanceGroups(listInstanceGroupsOptions *ListInstanceGroupsOptions)`, func() { + Describe(`ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptions *ListInstanceVolumeAttachmentsOptions)`, func() { version := "testString" - listInstanceGroupsPath := "/instance_groups" + listInstanceVolumeAttachmentsPath := "/instances/testString/volume_attachments" 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(listInstanceGroupsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceVolumeAttachmentsPath)) 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(10))})) // 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/instance_groups?limit=20"}, "instance_groups": [{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "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"}], "updated_at": "2019-01-01T12:00:00.000Z", "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"}}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"volume_attachments": [{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}]}`) })) }) - It(`Invoke ListInstanceGroups successfully with retries`, func() { + It(`Invoke ListInstanceVolumeAttachments successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -27239,22 +27769,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListInstanceGroupsOptions model - listInstanceGroupsOptionsModel := new(vpcv1.ListInstanceGroupsOptions) - listInstanceGroupsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceVolumeAttachmentsOptions model + listInstanceVolumeAttachmentsOptionsModel := new(vpcv1.ListInstanceVolumeAttachmentsOptions) + listInstanceVolumeAttachmentsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceVolumeAttachmentsOptionsModel.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.ListInstanceGroupsWithContext(ctx, listInstanceGroupsOptionsModel) + _, _, operationErr := vpcService.ListInstanceVolumeAttachmentsWithContext(ctx, listInstanceVolumeAttachmentsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListInstanceGroups(listInstanceGroupsOptionsModel) + result, response, operationErr := vpcService.ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -27262,7 +27791,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListInstanceGroupsWithContext(ctx, listInstanceGroupsOptionsModel) + _, _, operationErr = vpcService.ListInstanceVolumeAttachmentsWithContext(ctx, listInstanceVolumeAttachmentsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -27276,20 +27805,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceVolumeAttachmentsPath)) 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(10))})) // 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/instance_groups?limit=20"}, "instance_groups": [{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "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"}], "updated_at": "2019-01-01T12:00:00.000Z", "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"}}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"volume_attachments": [{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}]}`) })) }) - It(`Invoke ListInstanceGroups successfully`, func() { + It(`Invoke ListInstanceVolumeAttachments successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -27299,25 +27826,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListInstanceGroups(nil) + result, response, operationErr := vpcService.ListInstanceVolumeAttachments(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListInstanceGroupsOptions model - listInstanceGroupsOptionsModel := new(vpcv1.ListInstanceGroupsOptions) - listInstanceGroupsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceVolumeAttachmentsOptions model + listInstanceVolumeAttachmentsOptionsModel := new(vpcv1.ListInstanceVolumeAttachmentsOptions) + listInstanceVolumeAttachmentsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceVolumeAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListInstanceGroups(listInstanceGroupsOptionsModel) + result, response, operationErr = vpcService.ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListInstanceGroups with error: Operation request error`, func() { + It(`Invoke ListInstanceVolumeAttachments with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -27326,19 +27852,25 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceGroupsOptions model - listInstanceGroupsOptionsModel := new(vpcv1.ListInstanceGroupsOptions) - listInstanceGroupsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceVolumeAttachmentsOptions model + listInstanceVolumeAttachmentsOptionsModel := new(vpcv1.ListInstanceVolumeAttachmentsOptions) + listInstanceVolumeAttachmentsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceVolumeAttachmentsOptionsModel.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.ListInstanceGroups(listInstanceGroupsOptionsModel) + result, response, operationErr := vpcService.ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptionsModel) 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 ListInstanceVolumeAttachmentsOptions model with no property values + listInstanceVolumeAttachmentsOptionsModelNew := new(vpcv1.ListInstanceVolumeAttachmentsOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -27353,7 +27885,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListInstanceGroups successfully`, func() { + It(`Invoke ListInstanceVolumeAttachments successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -27362,14 +27894,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceGroupsOptions model - listInstanceGroupsOptionsModel := new(vpcv1.ListInstanceGroupsOptions) - listInstanceGroupsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceVolumeAttachmentsOptions model + listInstanceVolumeAttachmentsOptionsModel := new(vpcv1.ListInstanceVolumeAttachmentsOptions) + listInstanceVolumeAttachmentsOptionsModel.InstanceID = core.StringPtr("testString") + listInstanceVolumeAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListInstanceGroups(listInstanceGroupsOptionsModel) + result, response, operationErr := vpcService.ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -27380,118 +27911,17 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) - Context(`Test pagination helper method on response`, func() { - It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.InstanceGroupCollection) - nextObject := new(vpcv1.InstanceGroupCollectionNext) - 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.InstanceGroupCollection) - - 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.InstanceGroupCollection) - nextObject := new(vpcv1.InstanceGroupCollectionNext) - nextObject.Href = core.StringPtr("ibm.com") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - }) - Context(`Using mock server endpoint - paginated response`, func() { - BeforeEach(func() { - var requestNumber int = 0 - 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(listInstanceGroupsPath)) - Expect(req.Method).To(Equal("GET")) - - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - requestNumber++ - if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"instance_groups":[{"application_port":22,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","instance_template":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"a6b1a881-2ce8-41a3-80fc-36316a73f803","name":"my-instance-template"},"load_balancer_pool":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004","id":"70294e14-4e61-11e8-bcf4-0242ac110004","name":"my-load-balancer-pool"},"managers":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance-group-manager"}],"membership_count":10,"name":"my-instance-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"status":"deleting","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"}],"updated_at":"2019-01-01T12:00:00.000Z","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"}}]}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"instance_groups":[{"application_port":22,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","instance_template":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"a6b1a881-2ce8-41a3-80fc-36316a73f803","name":"my-instance-template"},"load_balancer_pool":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004","id":"70294e14-4e61-11e8-bcf4-0242ac110004","name":"my-load-balancer-pool"},"managers":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance-group-manager"}],"membership_count":10,"name":"my-instance-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"status":"deleting","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"}],"updated_at":"2019-01-01T12:00:00.000Z","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"}}]}`) - } else { - res.WriteHeader(400) - } - })) - }) - It(`Use InstanceGroupsPager.GetNext 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()) - - listInstanceGroupsOptionsModel := &vpcv1.ListInstanceGroupsOptions{ - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewInstanceGroupsPager(listInstanceGroupsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.InstanceGroup - for pager.HasNext() { - nextPage, err := pager.GetNext() - Expect(err).To(BeNil()) - Expect(nextPage).ToNot(BeNil()) - allResults = append(allResults, nextPage...) - } - Expect(len(allResults)).To(Equal(2)) - }) - It(`Use InstanceGroupsPager.GetAll 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()) - - listInstanceGroupsOptionsModel := &vpcv1.ListInstanceGroupsOptions{ - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewInstanceGroupsPager(listInstanceGroupsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - allResults, err := pager.GetAll() - Expect(err).To(BeNil()) - Expect(allResults).ToNot(BeNil()) - Expect(len(allResults)).To(Equal(2)) - }) - }) }) - Describe(`CreateInstanceGroup(createInstanceGroupOptions *CreateInstanceGroupOptions) - Operation response error`, func() { + Describe(`CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptions *CreateInstanceVolumeAttachmentOptions) - Operation response error`, func() { version := "testString" - createInstanceGroupPath := "/instance_groups" + createInstanceVolumeAttachmentPath := "/instances/testString/volume_attachments" 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(createInstanceGroupPath)) + Expect(req.URL.EscapedPath()).To(Equal(createInstanceVolumeAttachmentPath)) 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))})) @@ -27500,7 +27930,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateInstanceGroup with error: Operation response processing error`, func() { + It(`Invoke CreateInstanceVolumeAttachment with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -27509,46 +27939,26 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceTemplateIdentityByID model - instanceTemplateIdentityModel := new(vpcv1.InstanceTemplateIdentityByID) - instanceTemplateIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - - // 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 LoadBalancerIdentityByID model - loadBalancerIdentityModel := new(vpcv1.LoadBalancerIdentityByID) - loadBalancerIdentityModel.ID = core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727") - - // Construct an instance of the LoadBalancerPoolIdentityByID model - loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) - loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + // Construct an instance of the VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID model + volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) + volumeAttachmentPrototypeVolumeModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - // Construct an instance of the CreateInstanceGroupOptions model - createInstanceGroupOptionsModel := new(vpcv1.CreateInstanceGroupOptions) - createInstanceGroupOptionsModel.InstanceTemplate = instanceTemplateIdentityModel - createInstanceGroupOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - createInstanceGroupOptionsModel.ApplicationPort = core.Int64Ptr(int64(22)) - createInstanceGroupOptionsModel.LoadBalancer = loadBalancerIdentityModel - createInstanceGroupOptionsModel.LoadBalancerPool = loadBalancerPoolIdentityModel - createInstanceGroupOptionsModel.MembershipCount = core.Int64Ptr(int64(10)) - createInstanceGroupOptionsModel.Name = core.StringPtr("my-instance-group") - createInstanceGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel - createInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateInstanceVolumeAttachmentOptions model + createInstanceVolumeAttachmentOptionsModel := new(vpcv1.CreateInstanceVolumeAttachmentOptions) + createInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + createInstanceVolumeAttachmentOptionsModel.Volume = volumeAttachmentPrototypeVolumeModel + createInstanceVolumeAttachmentOptionsModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) + createInstanceVolumeAttachmentOptionsModel.Name = core.StringPtr("my-volume-attachment") + createInstanceVolumeAttachmentOptionsModel.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.CreateInstanceGroup(createInstanceGroupOptionsModel) + result, response, operationErr := vpcService.CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptionsModel) 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.CreateInstanceGroup(createInstanceGroupOptionsModel) + result, response, operationErr = vpcService.CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -27558,16 +27968,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateInstanceGroup(createInstanceGroupOptions *CreateInstanceGroupOptions)`, func() { + Describe(`CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptions *CreateInstanceVolumeAttachmentOptions)`, func() { version := "testString" - createInstanceGroupPath := "/instance_groups" + createInstanceVolumeAttachmentPath := "/instances/testString/volume_attachments" 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(createInstanceGroupPath)) + Expect(req.URL.EscapedPath()).To(Equal(createInstanceVolumeAttachmentPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -27594,10 +28004,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "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"}], "updated_at": "2019-01-01T12:00:00.000Z", "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", `{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}`) })) }) - It(`Invoke CreateInstanceGroup successfully with retries`, func() { + It(`Invoke CreateInstanceVolumeAttachment successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -27607,48 +28017,28 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the InstanceTemplateIdentityByID model - instanceTemplateIdentityModel := new(vpcv1.InstanceTemplateIdentityByID) - instanceTemplateIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - - // 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 LoadBalancerIdentityByID model - loadBalancerIdentityModel := new(vpcv1.LoadBalancerIdentityByID) - loadBalancerIdentityModel.ID = core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727") - - // Construct an instance of the LoadBalancerPoolIdentityByID model - loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) - loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + // Construct an instance of the VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID model + volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) + volumeAttachmentPrototypeVolumeModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - // Construct an instance of the CreateInstanceGroupOptions model - createInstanceGroupOptionsModel := new(vpcv1.CreateInstanceGroupOptions) - createInstanceGroupOptionsModel.InstanceTemplate = instanceTemplateIdentityModel - createInstanceGroupOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - createInstanceGroupOptionsModel.ApplicationPort = core.Int64Ptr(int64(22)) - createInstanceGroupOptionsModel.LoadBalancer = loadBalancerIdentityModel - createInstanceGroupOptionsModel.LoadBalancerPool = loadBalancerPoolIdentityModel - createInstanceGroupOptionsModel.MembershipCount = core.Int64Ptr(int64(10)) - createInstanceGroupOptionsModel.Name = core.StringPtr("my-instance-group") - createInstanceGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel - createInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateInstanceVolumeAttachmentOptions model + createInstanceVolumeAttachmentOptionsModel := new(vpcv1.CreateInstanceVolumeAttachmentOptions) + createInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + createInstanceVolumeAttachmentOptionsModel.Volume = volumeAttachmentPrototypeVolumeModel + createInstanceVolumeAttachmentOptionsModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) + createInstanceVolumeAttachmentOptionsModel.Name = core.StringPtr("my-volume-attachment") + createInstanceVolumeAttachmentOptionsModel.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.CreateInstanceGroupWithContext(ctx, createInstanceGroupOptionsModel) + _, _, operationErr := vpcService.CreateInstanceVolumeAttachmentWithContext(ctx, createInstanceVolumeAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateInstanceGroup(createInstanceGroupOptionsModel) + result, response, operationErr := vpcService.CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -27656,7 +28046,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreateInstanceGroupWithContext(ctx, createInstanceGroupOptionsModel) + _, _, operationErr = vpcService.CreateInstanceVolumeAttachmentWithContext(ctx, createInstanceVolumeAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -27670,7 +28060,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createInstanceGroupPath)) + Expect(req.URL.EscapedPath()).To(Equal(createInstanceVolumeAttachmentPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -27694,10 +28084,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "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"}], "updated_at": "2019-01-01T12:00:00.000Z", "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", `{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}`) })) }) - It(`Invoke CreateInstanceGroup successfully`, func() { + It(`Invoke CreateInstanceVolumeAttachment successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -27707,51 +28097,31 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreateInstanceGroup(nil) + result, response, operationErr := vpcService.CreateInstanceVolumeAttachment(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the InstanceTemplateIdentityByID model - instanceTemplateIdentityModel := new(vpcv1.InstanceTemplateIdentityByID) - instanceTemplateIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - - // 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 LoadBalancerIdentityByID model - loadBalancerIdentityModel := new(vpcv1.LoadBalancerIdentityByID) - loadBalancerIdentityModel.ID = core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727") - - // Construct an instance of the LoadBalancerPoolIdentityByID model - loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) - loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + // Construct an instance of the VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID model + volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) + volumeAttachmentPrototypeVolumeModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - // Construct an instance of the CreateInstanceGroupOptions model - createInstanceGroupOptionsModel := new(vpcv1.CreateInstanceGroupOptions) - createInstanceGroupOptionsModel.InstanceTemplate = instanceTemplateIdentityModel - createInstanceGroupOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - createInstanceGroupOptionsModel.ApplicationPort = core.Int64Ptr(int64(22)) - createInstanceGroupOptionsModel.LoadBalancer = loadBalancerIdentityModel - createInstanceGroupOptionsModel.LoadBalancerPool = loadBalancerPoolIdentityModel - createInstanceGroupOptionsModel.MembershipCount = core.Int64Ptr(int64(10)) - createInstanceGroupOptionsModel.Name = core.StringPtr("my-instance-group") - createInstanceGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel - createInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateInstanceVolumeAttachmentOptions model + createInstanceVolumeAttachmentOptionsModel := new(vpcv1.CreateInstanceVolumeAttachmentOptions) + createInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + createInstanceVolumeAttachmentOptionsModel.Volume = volumeAttachmentPrototypeVolumeModel + createInstanceVolumeAttachmentOptionsModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) + createInstanceVolumeAttachmentOptionsModel.Name = core.StringPtr("my-volume-attachment") + createInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateInstanceGroup(createInstanceGroupOptionsModel) + result, response, operationErr = vpcService.CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateInstanceGroup with error: Operation validation and request error`, func() { + It(`Invoke CreateInstanceVolumeAttachment with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -27760,49 +28130,29 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceTemplateIdentityByID model - instanceTemplateIdentityModel := new(vpcv1.InstanceTemplateIdentityByID) - instanceTemplateIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - - // 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 LoadBalancerIdentityByID model - loadBalancerIdentityModel := new(vpcv1.LoadBalancerIdentityByID) - loadBalancerIdentityModel.ID = core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727") - - // Construct an instance of the LoadBalancerPoolIdentityByID model - loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) - loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + // Construct an instance of the VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID model + volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) + volumeAttachmentPrototypeVolumeModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreateInstanceGroupOptions model - createInstanceGroupOptionsModel := new(vpcv1.CreateInstanceGroupOptions) - createInstanceGroupOptionsModel.InstanceTemplate = instanceTemplateIdentityModel - createInstanceGroupOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - createInstanceGroupOptionsModel.ApplicationPort = core.Int64Ptr(int64(22)) - createInstanceGroupOptionsModel.LoadBalancer = loadBalancerIdentityModel - createInstanceGroupOptionsModel.LoadBalancerPool = loadBalancerPoolIdentityModel - createInstanceGroupOptionsModel.MembershipCount = core.Int64Ptr(int64(10)) - createInstanceGroupOptionsModel.Name = core.StringPtr("my-instance-group") - createInstanceGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel - createInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateInstanceVolumeAttachmentOptions model + createInstanceVolumeAttachmentOptionsModel := new(vpcv1.CreateInstanceVolumeAttachmentOptions) + createInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + createInstanceVolumeAttachmentOptionsModel.Volume = volumeAttachmentPrototypeVolumeModel + createInstanceVolumeAttachmentOptionsModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) + createInstanceVolumeAttachmentOptionsModel.Name = core.StringPtr("my-volume-attachment") + createInstanceVolumeAttachmentOptionsModel.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.CreateInstanceGroup(createInstanceGroupOptionsModel) + result, response, operationErr := vpcService.CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptionsModel) 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 CreateInstanceGroupOptions model with no property values - createInstanceGroupOptionsModelNew := new(vpcv1.CreateInstanceGroupOptions) + // Construct a second instance of the CreateInstanceVolumeAttachmentOptions model with no property values + createInstanceVolumeAttachmentOptionsModelNew := new(vpcv1.CreateInstanceVolumeAttachmentOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateInstanceGroup(createInstanceGroupOptionsModelNew) + result, response, operationErr = vpcService.CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -27820,7 +28170,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(201) })) }) - It(`Invoke CreateInstanceGroup successfully`, func() { + It(`Invoke CreateInstanceVolumeAttachment successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -27829,40 +28179,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceTemplateIdentityByID model - instanceTemplateIdentityModel := new(vpcv1.InstanceTemplateIdentityByID) - instanceTemplateIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - - // 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 LoadBalancerIdentityByID model - loadBalancerIdentityModel := new(vpcv1.LoadBalancerIdentityByID) - loadBalancerIdentityModel.ID = core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727") - - // Construct an instance of the LoadBalancerPoolIdentityByID model - loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) - loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + // Construct an instance of the VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID model + volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) + volumeAttachmentPrototypeVolumeModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - // Construct an instance of the CreateInstanceGroupOptions model - createInstanceGroupOptionsModel := new(vpcv1.CreateInstanceGroupOptions) - createInstanceGroupOptionsModel.InstanceTemplate = instanceTemplateIdentityModel - createInstanceGroupOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - createInstanceGroupOptionsModel.ApplicationPort = core.Int64Ptr(int64(22)) - createInstanceGroupOptionsModel.LoadBalancer = loadBalancerIdentityModel - createInstanceGroupOptionsModel.LoadBalancerPool = loadBalancerPoolIdentityModel - createInstanceGroupOptionsModel.MembershipCount = core.Int64Ptr(int64(10)) - createInstanceGroupOptionsModel.Name = core.StringPtr("my-instance-group") - createInstanceGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel - createInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateInstanceVolumeAttachmentOptions model + createInstanceVolumeAttachmentOptionsModel := new(vpcv1.CreateInstanceVolumeAttachmentOptions) + createInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + createInstanceVolumeAttachmentOptionsModel.Volume = volumeAttachmentPrototypeVolumeModel + createInstanceVolumeAttachmentOptionsModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) + createInstanceVolumeAttachmentOptionsModel.Name = core.StringPtr("my-volume-attachment") + createInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.CreateInstanceGroup(createInstanceGroupOptionsModel) + result, response, operationErr := vpcService.CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -27874,16 +28204,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteInstanceGroup(deleteInstanceGroupOptions *DeleteInstanceGroupOptions)`, func() { + Describe(`DeleteInstanceVolumeAttachment(deleteInstanceVolumeAttachmentOptions *DeleteInstanceVolumeAttachmentOptions)`, func() { version := "testString" - deleteInstanceGroupPath := "/instance_groups/testString" + deleteInstanceVolumeAttachmentPath := "/instances/testString/volume_attachments/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(deleteInstanceGroupPath)) + Expect(req.URL.EscapedPath()).To(Equal(deleteInstanceVolumeAttachmentPath)) Expect(req.Method).To(Equal("DELETE")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -27891,7 +28221,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(204) })) }) - It(`Invoke DeleteInstanceGroup successfully`, func() { + It(`Invoke DeleteInstanceVolumeAttachment successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -27901,21 +28231,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.DeleteInstanceGroup(nil) + response, operationErr := vpcService.DeleteInstanceVolumeAttachment(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) - // Construct an instance of the DeleteInstanceGroupOptions model - deleteInstanceGroupOptionsModel := new(vpcv1.DeleteInstanceGroupOptions) - deleteInstanceGroupOptionsModel.ID = core.StringPtr("testString") - deleteInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteInstanceVolumeAttachmentOptions model + deleteInstanceVolumeAttachmentOptionsModel := new(vpcv1.DeleteInstanceVolumeAttachmentOptions) + deleteInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + deleteInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") + deleteInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteInstanceGroup(deleteInstanceGroupOptionsModel) + response, operationErr = vpcService.DeleteInstanceVolumeAttachment(deleteInstanceVolumeAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) }) - It(`Invoke DeleteInstanceGroup with error: Operation validation and request error`, func() { + It(`Invoke DeleteInstanceVolumeAttachment with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -27924,21 +28255,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteInstanceGroupOptions model - deleteInstanceGroupOptionsModel := new(vpcv1.DeleteInstanceGroupOptions) - deleteInstanceGroupOptionsModel.ID = core.StringPtr("testString") - deleteInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteInstanceVolumeAttachmentOptions model + deleteInstanceVolumeAttachmentOptionsModel := new(vpcv1.DeleteInstanceVolumeAttachmentOptions) + deleteInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + deleteInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") + deleteInstanceVolumeAttachmentOptionsModel.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.DeleteInstanceGroup(deleteInstanceGroupOptionsModel) + response, operationErr := vpcService.DeleteInstanceVolumeAttachment(deleteInstanceVolumeAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - // Construct a second instance of the DeleteInstanceGroupOptions model with no property values - deleteInstanceGroupOptionsModelNew := new(vpcv1.DeleteInstanceGroupOptions) + // Construct a second instance of the DeleteInstanceVolumeAttachmentOptions model with no property values + deleteInstanceVolumeAttachmentOptionsModelNew := new(vpcv1.DeleteInstanceVolumeAttachmentOptions) // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteInstanceGroup(deleteInstanceGroupOptionsModelNew) + response, operationErr = vpcService.DeleteInstanceVolumeAttachment(deleteInstanceVolumeAttachmentOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) }) @@ -27947,16 +28279,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetInstanceGroup(getInstanceGroupOptions *GetInstanceGroupOptions) - Operation response error`, func() { + Describe(`GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptions *GetInstanceVolumeAttachmentOptions) - Operation response error`, func() { version := "testString" - getInstanceGroupPath := "/instance_groups/testString" + getInstanceVolumeAttachmentPath := "/instances/testString/volume_attachments/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(getInstanceGroupPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceVolumeAttachmentPath)) 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))})) @@ -27965,7 +28297,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetInstanceGroup with error: Operation response processing error`, func() { + It(`Invoke GetInstanceVolumeAttachment with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -27974,19 +28306,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceGroupOptions model - getInstanceGroupOptionsModel := new(vpcv1.GetInstanceGroupOptions) - getInstanceGroupOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceVolumeAttachmentOptions model + getInstanceVolumeAttachmentOptionsModel := new(vpcv1.GetInstanceVolumeAttachmentOptions) + getInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") + getInstanceVolumeAttachmentOptionsModel.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.GetInstanceGroup(getInstanceGroupOptionsModel) + result, response, operationErr := vpcService.GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptionsModel) 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.GetInstanceGroup(getInstanceGroupOptionsModel) + result, response, operationErr = vpcService.GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -27996,16 +28329,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetInstanceGroup(getInstanceGroupOptions *GetInstanceGroupOptions)`, func() { + Describe(`GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptions *GetInstanceVolumeAttachmentOptions)`, func() { version := "testString" - getInstanceGroupPath := "/instance_groups/testString" + getInstanceVolumeAttachmentPath := "/instances/testString/volume_attachments/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(getInstanceGroupPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceVolumeAttachmentPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -28016,10 +28349,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "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"}], "updated_at": "2019-01-01T12:00:00.000Z", "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", `{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}`) })) }) - It(`Invoke GetInstanceGroup successfully with retries`, func() { + It(`Invoke GetInstanceVolumeAttachment successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -28029,21 +28362,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetInstanceGroupOptions model - getInstanceGroupOptionsModel := new(vpcv1.GetInstanceGroupOptions) - getInstanceGroupOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceVolumeAttachmentOptions model + getInstanceVolumeAttachmentOptionsModel := new(vpcv1.GetInstanceVolumeAttachmentOptions) + getInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") + getInstanceVolumeAttachmentOptionsModel.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.GetInstanceGroupWithContext(ctx, getInstanceGroupOptionsModel) + _, _, operationErr := vpcService.GetInstanceVolumeAttachmentWithContext(ctx, getInstanceVolumeAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetInstanceGroup(getInstanceGroupOptionsModel) + result, response, operationErr := vpcService.GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -28051,7 +28385,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetInstanceGroupWithContext(ctx, getInstanceGroupOptionsModel) + _, _, operationErr = vpcService.GetInstanceVolumeAttachmentWithContext(ctx, getInstanceVolumeAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -28065,7 +28399,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceVolumeAttachmentPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -28073,10 +28407,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "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"}], "updated_at": "2019-01-01T12:00:00.000Z", "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", `{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}`) })) }) - It(`Invoke GetInstanceGroup successfully`, func() { + It(`Invoke GetInstanceVolumeAttachment successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -28086,24 +28420,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetInstanceGroup(nil) + result, response, operationErr := vpcService.GetInstanceVolumeAttachment(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetInstanceGroupOptions model - getInstanceGroupOptionsModel := new(vpcv1.GetInstanceGroupOptions) - getInstanceGroupOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceVolumeAttachmentOptions model + getInstanceVolumeAttachmentOptionsModel := new(vpcv1.GetInstanceVolumeAttachmentOptions) + getInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") + getInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetInstanceGroup(getInstanceGroupOptionsModel) + result, response, operationErr = vpcService.GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetInstanceGroup with error: Operation validation and request error`, func() { + It(`Invoke GetInstanceVolumeAttachment with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -28112,22 +28447,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceGroupOptions model - getInstanceGroupOptionsModel := new(vpcv1.GetInstanceGroupOptions) - getInstanceGroupOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceVolumeAttachmentOptions model + getInstanceVolumeAttachmentOptionsModel := new(vpcv1.GetInstanceVolumeAttachmentOptions) + getInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") + getInstanceVolumeAttachmentOptionsModel.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.GetInstanceGroup(getInstanceGroupOptionsModel) + result, response, operationErr := vpcService.GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptionsModel) 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 GetInstanceGroupOptions model with no property values - getInstanceGroupOptionsModelNew := new(vpcv1.GetInstanceGroupOptions) + // Construct a second instance of the GetInstanceVolumeAttachmentOptions model with no property values + getInstanceVolumeAttachmentOptionsModelNew := new(vpcv1.GetInstanceVolumeAttachmentOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetInstanceGroup(getInstanceGroupOptionsModelNew) + result, response, operationErr = vpcService.GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -28145,7 +28481,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetInstanceGroup successfully`, func() { + It(`Invoke GetInstanceVolumeAttachment successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -28154,13 +28490,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceGroupOptions model - getInstanceGroupOptionsModel := new(vpcv1.GetInstanceGroupOptions) - getInstanceGroupOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceVolumeAttachmentOptions model + getInstanceVolumeAttachmentOptionsModel := new(vpcv1.GetInstanceVolumeAttachmentOptions) + getInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + getInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") + getInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetInstanceGroup(getInstanceGroupOptionsModel) + result, response, operationErr := vpcService.GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -28172,16 +28509,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateInstanceGroup(updateInstanceGroupOptions *UpdateInstanceGroupOptions) - Operation response error`, func() { + Describe(`UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptions *UpdateInstanceVolumeAttachmentOptions) - Operation response error`, func() { version := "testString" - updateInstanceGroupPath := "/instance_groups/testString" + updateInstanceVolumeAttachmentPath := "/instances/testString/volume_attachments/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(updateInstanceGroupPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceVolumeAttachmentPath)) 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))})) @@ -28190,7 +28527,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateInstanceGroup with error: Operation response processing error`, func() { + It(`Invoke UpdateInstanceVolumeAttachment with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -28199,48 +28536,28 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceTemplateIdentityByID model - instanceTemplateIdentityModel := new(vpcv1.InstanceTemplateIdentityByID) - instanceTemplateIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - - // Construct an instance of the LoadBalancerIdentityByID model - loadBalancerIdentityModel := new(vpcv1.LoadBalancerIdentityByID) - loadBalancerIdentityModel.ID = core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727") - - // Construct an instance of the LoadBalancerPoolIdentityByID model - loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) - loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // 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 InstanceGroupPatch model - instanceGroupPatchModel := new(vpcv1.InstanceGroupPatch) - instanceGroupPatchModel.ApplicationPort = core.Int64Ptr(int64(22)) - instanceGroupPatchModel.InstanceTemplate = instanceTemplateIdentityModel - instanceGroupPatchModel.LoadBalancer = loadBalancerIdentityModel - instanceGroupPatchModel.LoadBalancerPool = loadBalancerPoolIdentityModel - instanceGroupPatchModel.MembershipCount = core.Int64Ptr(int64(10)) - instanceGroupPatchModel.Name = core.StringPtr("my-instance-group") - instanceGroupPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - instanceGroupPatchModelAsPatch, asPatchErr := instanceGroupPatchModel.AsPatch() + // Construct an instance of the VolumeAttachmentPatch model + volumeAttachmentPatchModel := new(vpcv1.VolumeAttachmentPatch) + volumeAttachmentPatchModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) + volumeAttachmentPatchModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPatchModelAsPatch, asPatchErr := volumeAttachmentPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupOptions model - updateInstanceGroupOptionsModel := new(vpcv1.UpdateInstanceGroupOptions) - updateInstanceGroupOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupOptionsModel.InstanceGroupPatch = instanceGroupPatchModelAsPatch - updateInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceVolumeAttachmentOptions model + updateInstanceVolumeAttachmentOptionsModel := new(vpcv1.UpdateInstanceVolumeAttachmentOptions) + updateInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + updateInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") + updateInstanceVolumeAttachmentOptionsModel.VolumeAttachmentPatch = volumeAttachmentPatchModelAsPatch + updateInstanceVolumeAttachmentOptionsModel.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.UpdateInstanceGroup(updateInstanceGroupOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptionsModel) 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.UpdateInstanceGroup(updateInstanceGroupOptionsModel) + result, response, operationErr = vpcService.UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -28250,16 +28567,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateInstanceGroup(updateInstanceGroupOptions *UpdateInstanceGroupOptions)`, func() { + Describe(`UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptions *UpdateInstanceVolumeAttachmentOptions)`, func() { version := "testString" - updateInstanceGroupPath := "/instance_groups/testString" + updateInstanceVolumeAttachmentPath := "/instances/testString/volume_attachments/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(updateInstanceGroupPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceVolumeAttachmentPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -28286,10 +28603,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "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"}], "updated_at": "2019-01-01T12:00:00.000Z", "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", `{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}`) })) }) - It(`Invoke UpdateInstanceGroup successfully with retries`, func() { + It(`Invoke UpdateInstanceVolumeAttachment successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -28299,50 +28616,30 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the InstanceTemplateIdentityByID model - instanceTemplateIdentityModel := new(vpcv1.InstanceTemplateIdentityByID) - instanceTemplateIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - - // Construct an instance of the LoadBalancerIdentityByID model - loadBalancerIdentityModel := new(vpcv1.LoadBalancerIdentityByID) - loadBalancerIdentityModel.ID = core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727") - - // Construct an instance of the LoadBalancerPoolIdentityByID model - loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) - loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // 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 InstanceGroupPatch model - instanceGroupPatchModel := new(vpcv1.InstanceGroupPatch) - instanceGroupPatchModel.ApplicationPort = core.Int64Ptr(int64(22)) - instanceGroupPatchModel.InstanceTemplate = instanceTemplateIdentityModel - instanceGroupPatchModel.LoadBalancer = loadBalancerIdentityModel - instanceGroupPatchModel.LoadBalancerPool = loadBalancerPoolIdentityModel - instanceGroupPatchModel.MembershipCount = core.Int64Ptr(int64(10)) - instanceGroupPatchModel.Name = core.StringPtr("my-instance-group") - instanceGroupPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - instanceGroupPatchModelAsPatch, asPatchErr := instanceGroupPatchModel.AsPatch() + // Construct an instance of the VolumeAttachmentPatch model + volumeAttachmentPatchModel := new(vpcv1.VolumeAttachmentPatch) + volumeAttachmentPatchModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) + volumeAttachmentPatchModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPatchModelAsPatch, asPatchErr := volumeAttachmentPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupOptions model - updateInstanceGroupOptionsModel := new(vpcv1.UpdateInstanceGroupOptions) - updateInstanceGroupOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupOptionsModel.InstanceGroupPatch = instanceGroupPatchModelAsPatch - updateInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceVolumeAttachmentOptions model + updateInstanceVolumeAttachmentOptionsModel := new(vpcv1.UpdateInstanceVolumeAttachmentOptions) + updateInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + updateInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") + updateInstanceVolumeAttachmentOptionsModel.VolumeAttachmentPatch = volumeAttachmentPatchModelAsPatch + updateInstanceVolumeAttachmentOptionsModel.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.UpdateInstanceGroupWithContext(ctx, updateInstanceGroupOptionsModel) + _, _, operationErr := vpcService.UpdateInstanceVolumeAttachmentWithContext(ctx, updateInstanceVolumeAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateInstanceGroup(updateInstanceGroupOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -28350,7 +28647,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateInstanceGroupWithContext(ctx, updateInstanceGroupOptionsModel) + _, _, operationErr = vpcService.UpdateInstanceVolumeAttachmentWithContext(ctx, updateInstanceVolumeAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -28364,7 +28661,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceVolumeAttachmentPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -28388,10 +28685,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "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"}], "updated_at": "2019-01-01T12:00:00.000Z", "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", `{"bandwidth": 250, "created_at": "2019-01-01T12:00:00.000Z", "delete_volume_on_instance_delete": true, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "resource_type": "volume"}}`) })) }) - It(`Invoke UpdateInstanceGroup successfully`, func() { + It(`Invoke UpdateInstanceVolumeAttachment successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -28401,53 +28698,33 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateInstanceGroup(nil) + result, response, operationErr := vpcService.UpdateInstanceVolumeAttachment(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the InstanceTemplateIdentityByID model - instanceTemplateIdentityModel := new(vpcv1.InstanceTemplateIdentityByID) - instanceTemplateIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - - // Construct an instance of the LoadBalancerIdentityByID model - loadBalancerIdentityModel := new(vpcv1.LoadBalancerIdentityByID) - loadBalancerIdentityModel.ID = core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727") - - // Construct an instance of the LoadBalancerPoolIdentityByID model - loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) - loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // 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 InstanceGroupPatch model - instanceGroupPatchModel := new(vpcv1.InstanceGroupPatch) - instanceGroupPatchModel.ApplicationPort = core.Int64Ptr(int64(22)) - instanceGroupPatchModel.InstanceTemplate = instanceTemplateIdentityModel - instanceGroupPatchModel.LoadBalancer = loadBalancerIdentityModel - instanceGroupPatchModel.LoadBalancerPool = loadBalancerPoolIdentityModel - instanceGroupPatchModel.MembershipCount = core.Int64Ptr(int64(10)) - instanceGroupPatchModel.Name = core.StringPtr("my-instance-group") - instanceGroupPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - instanceGroupPatchModelAsPatch, asPatchErr := instanceGroupPatchModel.AsPatch() + // Construct an instance of the VolumeAttachmentPatch model + volumeAttachmentPatchModel := new(vpcv1.VolumeAttachmentPatch) + volumeAttachmentPatchModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) + volumeAttachmentPatchModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPatchModelAsPatch, asPatchErr := volumeAttachmentPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupOptions model - updateInstanceGroupOptionsModel := new(vpcv1.UpdateInstanceGroupOptions) - updateInstanceGroupOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupOptionsModel.InstanceGroupPatch = instanceGroupPatchModelAsPatch - updateInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceVolumeAttachmentOptions model + updateInstanceVolumeAttachmentOptionsModel := new(vpcv1.UpdateInstanceVolumeAttachmentOptions) + updateInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + updateInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") + updateInstanceVolumeAttachmentOptionsModel.VolumeAttachmentPatch = volumeAttachmentPatchModelAsPatch + updateInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateInstanceGroup(updateInstanceGroupOptionsModel) + result, response, operationErr = vpcService.UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateInstanceGroup with error: Operation validation and request error`, func() { + It(`Invoke UpdateInstanceVolumeAttachment with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -28456,51 +28733,31 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceTemplateIdentityByID model - instanceTemplateIdentityModel := new(vpcv1.InstanceTemplateIdentityByID) - instanceTemplateIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - - // Construct an instance of the LoadBalancerIdentityByID model - loadBalancerIdentityModel := new(vpcv1.LoadBalancerIdentityByID) - loadBalancerIdentityModel.ID = core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727") - - // Construct an instance of the LoadBalancerPoolIdentityByID model - loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) - loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // 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 InstanceGroupPatch model - instanceGroupPatchModel := new(vpcv1.InstanceGroupPatch) - instanceGroupPatchModel.ApplicationPort = core.Int64Ptr(int64(22)) - instanceGroupPatchModel.InstanceTemplate = instanceTemplateIdentityModel - instanceGroupPatchModel.LoadBalancer = loadBalancerIdentityModel - instanceGroupPatchModel.LoadBalancerPool = loadBalancerPoolIdentityModel - instanceGroupPatchModel.MembershipCount = core.Int64Ptr(int64(10)) - instanceGroupPatchModel.Name = core.StringPtr("my-instance-group") - instanceGroupPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - instanceGroupPatchModelAsPatch, asPatchErr := instanceGroupPatchModel.AsPatch() + // Construct an instance of the VolumeAttachmentPatch model + volumeAttachmentPatchModel := new(vpcv1.VolumeAttachmentPatch) + volumeAttachmentPatchModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) + volumeAttachmentPatchModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPatchModelAsPatch, asPatchErr := volumeAttachmentPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupOptions model - updateInstanceGroupOptionsModel := new(vpcv1.UpdateInstanceGroupOptions) - updateInstanceGroupOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupOptionsModel.InstanceGroupPatch = instanceGroupPatchModelAsPatch - updateInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceVolumeAttachmentOptions model + updateInstanceVolumeAttachmentOptionsModel := new(vpcv1.UpdateInstanceVolumeAttachmentOptions) + updateInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + updateInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") + updateInstanceVolumeAttachmentOptionsModel.VolumeAttachmentPatch = volumeAttachmentPatchModelAsPatch + updateInstanceVolumeAttachmentOptionsModel.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.UpdateInstanceGroup(updateInstanceGroupOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptionsModel) 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 UpdateInstanceGroupOptions model with no property values - updateInstanceGroupOptionsModelNew := new(vpcv1.UpdateInstanceGroupOptions) + // Construct a second instance of the UpdateInstanceVolumeAttachmentOptions model with no property values + updateInstanceVolumeAttachmentOptionsModelNew := new(vpcv1.UpdateInstanceVolumeAttachmentOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateInstanceGroup(updateInstanceGroupOptionsModelNew) + result, response, operationErr = vpcService.UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -28518,7 +28775,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateInstanceGroup successfully`, func() { + It(`Invoke UpdateInstanceVolumeAttachment successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -28527,42 +28784,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceTemplateIdentityByID model - instanceTemplateIdentityModel := new(vpcv1.InstanceTemplateIdentityByID) - instanceTemplateIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - - // Construct an instance of the LoadBalancerIdentityByID model - loadBalancerIdentityModel := new(vpcv1.LoadBalancerIdentityByID) - loadBalancerIdentityModel.ID = core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727") - - // Construct an instance of the LoadBalancerPoolIdentityByID model - loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) - loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // 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 InstanceGroupPatch model - instanceGroupPatchModel := new(vpcv1.InstanceGroupPatch) - instanceGroupPatchModel.ApplicationPort = core.Int64Ptr(int64(22)) - instanceGroupPatchModel.InstanceTemplate = instanceTemplateIdentityModel - instanceGroupPatchModel.LoadBalancer = loadBalancerIdentityModel - instanceGroupPatchModel.LoadBalancerPool = loadBalancerPoolIdentityModel - instanceGroupPatchModel.MembershipCount = core.Int64Ptr(int64(10)) - instanceGroupPatchModel.Name = core.StringPtr("my-instance-group") - instanceGroupPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - instanceGroupPatchModelAsPatch, asPatchErr := instanceGroupPatchModel.AsPatch() + // Construct an instance of the VolumeAttachmentPatch model + volumeAttachmentPatchModel := new(vpcv1.VolumeAttachmentPatch) + volumeAttachmentPatchModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) + volumeAttachmentPatchModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPatchModelAsPatch, asPatchErr := volumeAttachmentPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupOptions model - updateInstanceGroupOptionsModel := new(vpcv1.UpdateInstanceGroupOptions) - updateInstanceGroupOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupOptionsModel.InstanceGroupPatch = instanceGroupPatchModelAsPatch - updateInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceVolumeAttachmentOptions model + updateInstanceVolumeAttachmentOptionsModel := new(vpcv1.UpdateInstanceVolumeAttachmentOptions) + updateInstanceVolumeAttachmentOptionsModel.InstanceID = core.StringPtr("testString") + updateInstanceVolumeAttachmentOptionsModel.ID = core.StringPtr("testString") + updateInstanceVolumeAttachmentOptionsModel.VolumeAttachmentPatch = volumeAttachmentPatchModelAsPatch + updateInstanceVolumeAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.UpdateInstanceGroup(updateInstanceGroupOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -28574,24 +28811,27 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteInstanceGroupLoadBalancer(deleteInstanceGroupLoadBalancerOptions *DeleteInstanceGroupLoadBalancerOptions)`, func() { + Describe(`ListInstanceGroups(listInstanceGroupsOptions *ListInstanceGroupsOptions) - Operation response error`, func() { version := "testString" - deleteInstanceGroupLoadBalancerPath := "/instance_groups/testString/load_balancer" - Context(`Using mock server endpoint`, func() { + listInstanceGroupsPath := "/instance_groups" + 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(deleteInstanceGroupLoadBalancerPath)) - Expect(req.Method).To(Equal("DELETE")) - + Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupsPath)) + 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.WriteHeader(204) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke DeleteInstanceGroupLoadBalancer successfully`, func() { + It(`Invoke ListInstanceGroups with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -28600,97 +28840,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.DeleteInstanceGroupLoadBalancer(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteInstanceGroupLoadBalancerOptions model - deleteInstanceGroupLoadBalancerOptionsModel := new(vpcv1.DeleteInstanceGroupLoadBalancerOptions) - deleteInstanceGroupLoadBalancerOptionsModel.InstanceGroupID = core.StringPtr("testString") - deleteInstanceGroupLoadBalancerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteInstanceGroupLoadBalancer(deleteInstanceGroupLoadBalancerOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteInstanceGroupLoadBalancer 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 DeleteInstanceGroupLoadBalancerOptions model - deleteInstanceGroupLoadBalancerOptionsModel := new(vpcv1.DeleteInstanceGroupLoadBalancerOptions) - deleteInstanceGroupLoadBalancerOptionsModel.InstanceGroupID = core.StringPtr("testString") - deleteInstanceGroupLoadBalancerOptionsModel.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.DeleteInstanceGroupLoadBalancer(deleteInstanceGroupLoadBalancerOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteInstanceGroupLoadBalancerOptions model with no property values - deleteInstanceGroupLoadBalancerOptionsModelNew := new(vpcv1.DeleteInstanceGroupLoadBalancerOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteInstanceGroupLoadBalancer(deleteInstanceGroupLoadBalancerOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListInstanceGroupManagers(listInstanceGroupManagersOptions *ListInstanceGroupManagersOptions) - Operation response error`, func() { - version := "testString" - listInstanceGroupManagersPath := "/instance_groups/testString/managers" - 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(listInstanceGroupManagersPath)) - 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(10))})) - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprint(res, `} this is not valid json {`) - })) - }) - It(`Invoke ListInstanceGroupManagers 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 ListInstanceGroupManagersOptions model - listInstanceGroupManagersOptionsModel := new(vpcv1.ListInstanceGroupManagersOptions) - listInstanceGroupManagersOptionsModel.InstanceGroupID = core.StringPtr("testString") - listInstanceGroupManagersOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagersOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupManagersOptionsModel.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.ListInstanceGroupManagers(listInstanceGroupManagersOptionsModel) - Expect(operationErr).ToNot(BeNil()) + // Construct an instance of the ListInstanceGroupsOptions model + listInstanceGroupsOptionsModel := new(vpcv1.ListInstanceGroupsOptions) + listInstanceGroupsOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupsOptionsModel.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.ListInstanceGroups(listInstanceGroupsOptionsModel) + 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.ListInstanceGroupManagers(listInstanceGroupManagersOptionsModel) + result, response, operationErr = vpcService.ListInstanceGroups(listInstanceGroupsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -28700,16 +28863,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListInstanceGroupManagers(listInstanceGroupManagersOptions *ListInstanceGroupManagersOptions)`, func() { + Describe(`ListInstanceGroups(listInstanceGroupsOptions *ListInstanceGroupsOptions)`, func() { version := "testString" - listInstanceGroupManagersPath := "/instance_groups/testString/managers" + listInstanceGroupsPath := "/instance_groups" 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(listInstanceGroupManagersPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -28722,10 +28885,10 @@ 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/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers?limit=20"}, "limit": 20, "managers": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "management_enabled": false, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy"}]}], "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups?limit=20"}, "instance_groups": [{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "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"}], "updated_at": "2019-01-01T12:00:00.000Z", "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"}}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) })) }) - It(`Invoke ListInstanceGroupManagers successfully with retries`, func() { + It(`Invoke ListInstanceGroups successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -28735,23 +28898,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListInstanceGroupManagersOptions model - listInstanceGroupManagersOptionsModel := new(vpcv1.ListInstanceGroupManagersOptions) - listInstanceGroupManagersOptionsModel.InstanceGroupID = core.StringPtr("testString") - listInstanceGroupManagersOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagersOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupManagersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupsOptions model + listInstanceGroupsOptionsModel := new(vpcv1.ListInstanceGroupsOptions) + listInstanceGroupsOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupsOptionsModel.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.ListInstanceGroupManagersWithContext(ctx, listInstanceGroupManagersOptionsModel) + _, _, operationErr := vpcService.ListInstanceGroupsWithContext(ctx, listInstanceGroupsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListInstanceGroupManagers(listInstanceGroupManagersOptionsModel) + result, response, operationErr := vpcService.ListInstanceGroups(listInstanceGroupsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -28759,7 +28921,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListInstanceGroupManagersWithContext(ctx, listInstanceGroupManagersOptionsModel) + _, _, operationErr = vpcService.ListInstanceGroupsWithContext(ctx, listInstanceGroupsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -28773,7 +28935,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupManagersPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -28783,10 +28945,10 @@ 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/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers?limit=20"}, "limit": 20, "managers": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "management_enabled": false, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy"}]}], "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups?limit=20"}, "instance_groups": [{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "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"}], "updated_at": "2019-01-01T12:00:00.000Z", "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"}}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) })) }) - It(`Invoke ListInstanceGroupManagers successfully`, func() { + It(`Invoke ListInstanceGroups successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -28796,26 +28958,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListInstanceGroupManagers(nil) + result, response, operationErr := vpcService.ListInstanceGroups(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListInstanceGroupManagersOptions model - listInstanceGroupManagersOptionsModel := new(vpcv1.ListInstanceGroupManagersOptions) - listInstanceGroupManagersOptionsModel.InstanceGroupID = core.StringPtr("testString") - listInstanceGroupManagersOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagersOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupManagersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupsOptions model + listInstanceGroupsOptionsModel := new(vpcv1.ListInstanceGroupsOptions) + listInstanceGroupsOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListInstanceGroupManagers(listInstanceGroupManagersOptionsModel) + result, response, operationErr = vpcService.ListInstanceGroups(listInstanceGroupsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListInstanceGroupManagers with error: Operation validation and request error`, func() { + It(`Invoke ListInstanceGroups with error: Operation request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -28824,27 +28985,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceGroupManagersOptions model - listInstanceGroupManagersOptionsModel := new(vpcv1.ListInstanceGroupManagersOptions) - listInstanceGroupManagersOptionsModel.InstanceGroupID = core.StringPtr("testString") - listInstanceGroupManagersOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagersOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupManagersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupsOptions model + listInstanceGroupsOptionsModel := new(vpcv1.ListInstanceGroupsOptions) + listInstanceGroupsOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupsOptionsModel.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.ListInstanceGroupManagers(listInstanceGroupManagersOptionsModel) + result, response, operationErr := vpcService.ListInstanceGroups(listInstanceGroupsOptionsModel) 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 ListInstanceGroupManagersOptions model with no property values - listInstanceGroupManagersOptionsModelNew := new(vpcv1.ListInstanceGroupManagersOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListInstanceGroupManagers(listInstanceGroupManagersOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -28859,7 +29012,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListInstanceGroupManagers successfully`, func() { + It(`Invoke ListInstanceGroups successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -28868,15 +29021,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceGroupManagersOptions model - listInstanceGroupManagersOptionsModel := new(vpcv1.ListInstanceGroupManagersOptions) - listInstanceGroupManagersOptionsModel.InstanceGroupID = core.StringPtr("testString") - listInstanceGroupManagersOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagersOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupManagersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupsOptions model + listInstanceGroupsOptionsModel := new(vpcv1.ListInstanceGroupsOptions) + listInstanceGroupsOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListInstanceGroupManagers(listInstanceGroupManagersOptionsModel) + result, response, operationErr := vpcService.ListInstanceGroups(listInstanceGroupsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -28889,8 +29041,8 @@ var _ = Describe(`VpcV1`, func() { }) Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.InstanceGroupManagerCollection) - nextObject := new(vpcv1.InstanceGroupManagerCollectionNext) + responseObject := new(vpcv1.InstanceGroupCollection) + nextObject := new(vpcv1.InstanceGroupCollectionNext) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -28899,15 +29051,15 @@ var _ = Describe(`VpcV1`, func() { Expect(value).To(Equal(core.StringPtr("abc-123"))) }) It(`Invoke GetNextStart without a "Next" property in the response`, func() { - responseObject := new(vpcv1.InstanceGroupManagerCollection) + responseObject := new(vpcv1.InstanceGroupCollection) 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.InstanceGroupManagerCollection) - nextObject := new(vpcv1.InstanceGroupManagerCollectionNext) + responseObject := new(vpcv1.InstanceGroupCollection) + nextObject := new(vpcv1.InstanceGroupCollectionNext) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -28923,7 +29075,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupManagersPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupsPath)) Expect(req.Method).To(Equal("GET")) // Set mock response @@ -28931,15 +29083,15 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) requestNumber++ if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"managers":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","management_enabled":false,"name":"my-instance-group-manager","updated_at":"2019-01-01T12:00:00.000Z","aggregation_window":120,"cooldown":210,"manager_type":"autoscale","max_membership_count":10,"min_membership_count":10,"policies":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance-group-manager-policy"}]}]}`) + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"instance_groups":[{"application_port":22,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","instance_template":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"a6b1a881-2ce8-41a3-80fc-36316a73f803","name":"my-instance-template"},"load_balancer_pool":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004","id":"70294e14-4e61-11e8-bcf4-0242ac110004","name":"my-load-balancer-pool"},"managers":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance-group-manager"}],"membership_count":10,"name":"my-instance-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"status":"deleting","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"}],"updated_at":"2019-01-01T12:00:00.000Z","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"}}]}`) } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"managers":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","management_enabled":false,"name":"my-instance-group-manager","updated_at":"2019-01-01T12:00:00.000Z","aggregation_window":120,"cooldown":210,"manager_type":"autoscale","max_membership_count":10,"min_membership_count":10,"policies":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance-group-manager-policy"}]}]}`) + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"instance_groups":[{"application_port":22,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","instance_template":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"a6b1a881-2ce8-41a3-80fc-36316a73f803","name":"my-instance-template"},"load_balancer_pool":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004","id":"70294e14-4e61-11e8-bcf4-0242ac110004","name":"my-load-balancer-pool"},"managers":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance-group-manager"}],"membership_count":10,"name":"my-instance-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"status":"deleting","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"}],"updated_at":"2019-01-01T12:00:00.000Z","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"}}]}`) } else { res.WriteHeader(400) } })) }) - It(`Use InstanceGroupManagersPager.GetNext successfully`, func() { + It(`Use InstanceGroupsPager.GetNext successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -28948,16 +29100,15 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listInstanceGroupManagersOptionsModel := &vpcv1.ListInstanceGroupManagersOptions{ - InstanceGroupID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), + listInstanceGroupsOptionsModel := &vpcv1.ListInstanceGroupsOptions{ + Limit: core.Int64Ptr(int64(10)), } - pager, err := vpcService.NewInstanceGroupManagersPager(listInstanceGroupManagersOptionsModel) + pager, err := vpcService.NewInstanceGroupsPager(listInstanceGroupsOptionsModel) Expect(err).To(BeNil()) Expect(pager).ToNot(BeNil()) - var allResults []vpcv1.InstanceGroupManagerIntf + var allResults []vpcv1.InstanceGroup for pager.HasNext() { nextPage, err := pager.GetNext() Expect(err).To(BeNil()) @@ -28966,7 +29117,7 @@ var _ = Describe(`VpcV1`, func() { } Expect(len(allResults)).To(Equal(2)) }) - It(`Use InstanceGroupManagersPager.GetAll successfully`, func() { + It(`Use InstanceGroupsPager.GetAll successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -28975,12 +29126,11 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listInstanceGroupManagersOptionsModel := &vpcv1.ListInstanceGroupManagersOptions{ - InstanceGroupID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), + listInstanceGroupsOptionsModel := &vpcv1.ListInstanceGroupsOptions{ + Limit: core.Int64Ptr(int64(10)), } - pager, err := vpcService.NewInstanceGroupManagersPager(listInstanceGroupManagersOptionsModel) + pager, err := vpcService.NewInstanceGroupsPager(listInstanceGroupsOptionsModel) Expect(err).To(BeNil()) Expect(pager).ToNot(BeNil()) @@ -28991,16 +29141,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateInstanceGroupManager(createInstanceGroupManagerOptions *CreateInstanceGroupManagerOptions) - Operation response error`, func() { + Describe(`CreateInstanceGroup(createInstanceGroupOptions *CreateInstanceGroupOptions) - Operation response error`, func() { version := "testString" - createInstanceGroupManagerPath := "/instance_groups/testString/managers" + createInstanceGroupPath := "/instance_groups" 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(createInstanceGroupManagerPath)) + Expect(req.URL.EscapedPath()).To(Equal(createInstanceGroupPath)) 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))})) @@ -29009,7 +29159,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateInstanceGroupManager with error: Operation response processing error`, func() { + It(`Invoke CreateInstanceGroup with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -29018,30 +29168,46 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype model - instanceGroupManagerPrototypeModel := new(vpcv1.InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype) - instanceGroupManagerPrototypeModel.ManagementEnabled = core.BoolPtr(true) - instanceGroupManagerPrototypeModel.Name = core.StringPtr("my-instance-group-manager") - instanceGroupManagerPrototypeModel.AggregationWindow = core.Int64Ptr(int64(120)) - instanceGroupManagerPrototypeModel.Cooldown = core.Int64Ptr(int64(210)) - instanceGroupManagerPrototypeModel.ManagerType = core.StringPtr("autoscale") - instanceGroupManagerPrototypeModel.MaxMembershipCount = core.Int64Ptr(int64(10)) - instanceGroupManagerPrototypeModel.MinMembershipCount = core.Int64Ptr(int64(10)) + // Construct an instance of the InstanceTemplateIdentityByID model + instanceTemplateIdentityModel := new(vpcv1.InstanceTemplateIdentityByID) + instanceTemplateIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - // Construct an instance of the CreateInstanceGroupManagerOptions model - createInstanceGroupManagerOptionsModel := new(vpcv1.CreateInstanceGroupManagerOptions) - createInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") - createInstanceGroupManagerOptionsModel.InstanceGroupManagerPrototype = instanceGroupManagerPrototypeModel - createInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // 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 LoadBalancerIdentityByID model + loadBalancerIdentityModel := new(vpcv1.LoadBalancerIdentityByID) + loadBalancerIdentityModel.ID = core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727") + + // Construct an instance of the LoadBalancerPoolIdentityByID model + loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) + loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreateInstanceGroupOptions model + createInstanceGroupOptionsModel := new(vpcv1.CreateInstanceGroupOptions) + createInstanceGroupOptionsModel.InstanceTemplate = instanceTemplateIdentityModel + createInstanceGroupOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + createInstanceGroupOptionsModel.ApplicationPort = core.Int64Ptr(int64(22)) + createInstanceGroupOptionsModel.LoadBalancer = loadBalancerIdentityModel + createInstanceGroupOptionsModel.LoadBalancerPool = loadBalancerPoolIdentityModel + createInstanceGroupOptionsModel.MembershipCount = core.Int64Ptr(int64(10)) + createInstanceGroupOptionsModel.Name = core.StringPtr("my-instance-group") + createInstanceGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel + createInstanceGroupOptionsModel.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.CreateInstanceGroupManager(createInstanceGroupManagerOptionsModel) + result, response, operationErr := vpcService.CreateInstanceGroup(createInstanceGroupOptionsModel) 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.CreateInstanceGroupManager(createInstanceGroupManagerOptionsModel) + result, response, operationErr = vpcService.CreateInstanceGroup(createInstanceGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -29051,16 +29217,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateInstanceGroupManager(createInstanceGroupManagerOptions *CreateInstanceGroupManagerOptions)`, func() { + Describe(`CreateInstanceGroup(createInstanceGroupOptions *CreateInstanceGroupOptions)`, func() { version := "testString" - createInstanceGroupManagerPath := "/instance_groups/testString/managers" + createInstanceGroupPath := "/instance_groups" 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(createInstanceGroupManagerPath)) + Expect(req.URL.EscapedPath()).To(Equal(createInstanceGroupPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -29087,10 +29253,10 @@ 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/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "management_enabled": false, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy"}]}`) + fmt.Fprintf(res, "%s", `{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "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"}], "updated_at": "2019-01-01T12:00:00.000Z", "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 CreateInstanceGroupManager successfully with retries`, func() { + It(`Invoke CreateInstanceGroup successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -29100,32 +29266,48 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype model - instanceGroupManagerPrototypeModel := new(vpcv1.InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype) - instanceGroupManagerPrototypeModel.ManagementEnabled = core.BoolPtr(true) - instanceGroupManagerPrototypeModel.Name = core.StringPtr("my-instance-group-manager") - instanceGroupManagerPrototypeModel.AggregationWindow = core.Int64Ptr(int64(120)) - instanceGroupManagerPrototypeModel.Cooldown = core.Int64Ptr(int64(210)) - instanceGroupManagerPrototypeModel.ManagerType = core.StringPtr("autoscale") - instanceGroupManagerPrototypeModel.MaxMembershipCount = core.Int64Ptr(int64(10)) - instanceGroupManagerPrototypeModel.MinMembershipCount = core.Int64Ptr(int64(10)) + // Construct an instance of the InstanceTemplateIdentityByID model + instanceTemplateIdentityModel := new(vpcv1.InstanceTemplateIdentityByID) + instanceTemplateIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - // Construct an instance of the CreateInstanceGroupManagerOptions model - createInstanceGroupManagerOptionsModel := new(vpcv1.CreateInstanceGroupManagerOptions) - createInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") - createInstanceGroupManagerOptionsModel.InstanceGroupManagerPrototype = instanceGroupManagerPrototypeModel - createInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // 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 LoadBalancerIdentityByID model + loadBalancerIdentityModel := new(vpcv1.LoadBalancerIdentityByID) + loadBalancerIdentityModel.ID = core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727") + + // Construct an instance of the LoadBalancerPoolIdentityByID model + loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) + loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreateInstanceGroupOptions model + createInstanceGroupOptionsModel := new(vpcv1.CreateInstanceGroupOptions) + createInstanceGroupOptionsModel.InstanceTemplate = instanceTemplateIdentityModel + createInstanceGroupOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + createInstanceGroupOptionsModel.ApplicationPort = core.Int64Ptr(int64(22)) + createInstanceGroupOptionsModel.LoadBalancer = loadBalancerIdentityModel + createInstanceGroupOptionsModel.LoadBalancerPool = loadBalancerPoolIdentityModel + createInstanceGroupOptionsModel.MembershipCount = core.Int64Ptr(int64(10)) + createInstanceGroupOptionsModel.Name = core.StringPtr("my-instance-group") + createInstanceGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel + createInstanceGroupOptionsModel.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.CreateInstanceGroupManagerWithContext(ctx, createInstanceGroupManagerOptionsModel) + _, _, operationErr := vpcService.CreateInstanceGroupWithContext(ctx, createInstanceGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateInstanceGroupManager(createInstanceGroupManagerOptionsModel) + result, response, operationErr := vpcService.CreateInstanceGroup(createInstanceGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -29133,7 +29315,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreateInstanceGroupManagerWithContext(ctx, createInstanceGroupManagerOptionsModel) + _, _, operationErr = vpcService.CreateInstanceGroupWithContext(ctx, createInstanceGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -29147,7 +29329,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createInstanceGroupManagerPath)) + Expect(req.URL.EscapedPath()).To(Equal(createInstanceGroupPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -29171,10 +29353,10 @@ 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/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "management_enabled": false, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy"}]}`) + fmt.Fprintf(res, "%s", `{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "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"}], "updated_at": "2019-01-01T12:00:00.000Z", "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 CreateInstanceGroupManager successfully`, func() { + It(`Invoke CreateInstanceGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -29184,35 +29366,51 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreateInstanceGroupManager(nil) + result, response, operationErr := vpcService.CreateInstanceGroup(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype model - instanceGroupManagerPrototypeModel := new(vpcv1.InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype) - instanceGroupManagerPrototypeModel.ManagementEnabled = core.BoolPtr(true) - instanceGroupManagerPrototypeModel.Name = core.StringPtr("my-instance-group-manager") - instanceGroupManagerPrototypeModel.AggregationWindow = core.Int64Ptr(int64(120)) - instanceGroupManagerPrototypeModel.Cooldown = core.Int64Ptr(int64(210)) - instanceGroupManagerPrototypeModel.ManagerType = core.StringPtr("autoscale") - instanceGroupManagerPrototypeModel.MaxMembershipCount = core.Int64Ptr(int64(10)) - instanceGroupManagerPrototypeModel.MinMembershipCount = core.Int64Ptr(int64(10)) + // Construct an instance of the InstanceTemplateIdentityByID model + instanceTemplateIdentityModel := new(vpcv1.InstanceTemplateIdentityByID) + instanceTemplateIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - // Construct an instance of the CreateInstanceGroupManagerOptions model - createInstanceGroupManagerOptionsModel := new(vpcv1.CreateInstanceGroupManagerOptions) - createInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") - createInstanceGroupManagerOptionsModel.InstanceGroupManagerPrototype = instanceGroupManagerPrototypeModel - createInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // 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 LoadBalancerIdentityByID model + loadBalancerIdentityModel := new(vpcv1.LoadBalancerIdentityByID) + loadBalancerIdentityModel.ID = core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727") + + // Construct an instance of the LoadBalancerPoolIdentityByID model + loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) + loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreateInstanceGroupOptions model + createInstanceGroupOptionsModel := new(vpcv1.CreateInstanceGroupOptions) + createInstanceGroupOptionsModel.InstanceTemplate = instanceTemplateIdentityModel + createInstanceGroupOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + createInstanceGroupOptionsModel.ApplicationPort = core.Int64Ptr(int64(22)) + createInstanceGroupOptionsModel.LoadBalancer = loadBalancerIdentityModel + createInstanceGroupOptionsModel.LoadBalancerPool = loadBalancerPoolIdentityModel + createInstanceGroupOptionsModel.MembershipCount = core.Int64Ptr(int64(10)) + createInstanceGroupOptionsModel.Name = core.StringPtr("my-instance-group") + createInstanceGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel + createInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateInstanceGroupManager(createInstanceGroupManagerOptionsModel) + result, response, operationErr = vpcService.CreateInstanceGroup(createInstanceGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateInstanceGroupManager with error: Operation validation and request error`, func() { + It(`Invoke CreateInstanceGroup with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -29221,33 +29419,49 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype model - instanceGroupManagerPrototypeModel := new(vpcv1.InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype) - instanceGroupManagerPrototypeModel.ManagementEnabled = core.BoolPtr(true) - instanceGroupManagerPrototypeModel.Name = core.StringPtr("my-instance-group-manager") - instanceGroupManagerPrototypeModel.AggregationWindow = core.Int64Ptr(int64(120)) - instanceGroupManagerPrototypeModel.Cooldown = core.Int64Ptr(int64(210)) - instanceGroupManagerPrototypeModel.ManagerType = core.StringPtr("autoscale") - instanceGroupManagerPrototypeModel.MaxMembershipCount = core.Int64Ptr(int64(10)) - instanceGroupManagerPrototypeModel.MinMembershipCount = core.Int64Ptr(int64(10)) + // Construct an instance of the InstanceTemplateIdentityByID model + instanceTemplateIdentityModel := new(vpcv1.InstanceTemplateIdentityByID) + instanceTemplateIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - // Construct an instance of the CreateInstanceGroupManagerOptions model - createInstanceGroupManagerOptionsModel := new(vpcv1.CreateInstanceGroupManagerOptions) - createInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") - createInstanceGroupManagerOptionsModel.InstanceGroupManagerPrototype = instanceGroupManagerPrototypeModel - createInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // 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 LoadBalancerIdentityByID model + loadBalancerIdentityModel := new(vpcv1.LoadBalancerIdentityByID) + loadBalancerIdentityModel.ID = core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727") + + // Construct an instance of the LoadBalancerPoolIdentityByID model + loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) + loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreateInstanceGroupOptions model + createInstanceGroupOptionsModel := new(vpcv1.CreateInstanceGroupOptions) + createInstanceGroupOptionsModel.InstanceTemplate = instanceTemplateIdentityModel + createInstanceGroupOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + createInstanceGroupOptionsModel.ApplicationPort = core.Int64Ptr(int64(22)) + createInstanceGroupOptionsModel.LoadBalancer = loadBalancerIdentityModel + createInstanceGroupOptionsModel.LoadBalancerPool = loadBalancerPoolIdentityModel + createInstanceGroupOptionsModel.MembershipCount = core.Int64Ptr(int64(10)) + createInstanceGroupOptionsModel.Name = core.StringPtr("my-instance-group") + createInstanceGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel + createInstanceGroupOptionsModel.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.CreateInstanceGroupManager(createInstanceGroupManagerOptionsModel) + result, response, operationErr := vpcService.CreateInstanceGroup(createInstanceGroupOptionsModel) 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 CreateInstanceGroupManagerOptions model with no property values - createInstanceGroupManagerOptionsModelNew := new(vpcv1.CreateInstanceGroupManagerOptions) + // Construct a second instance of the CreateInstanceGroupOptions model with no property values + createInstanceGroupOptionsModelNew := new(vpcv1.CreateInstanceGroupOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateInstanceGroupManager(createInstanceGroupManagerOptionsModelNew) + result, response, operationErr = vpcService.CreateInstanceGroup(createInstanceGroupOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -29265,7 +29479,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(201) })) }) - It(`Invoke CreateInstanceGroupManager successfully`, func() { + It(`Invoke CreateInstanceGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -29274,24 +29488,40 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype model - instanceGroupManagerPrototypeModel := new(vpcv1.InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype) - instanceGroupManagerPrototypeModel.ManagementEnabled = core.BoolPtr(true) - instanceGroupManagerPrototypeModel.Name = core.StringPtr("my-instance-group-manager") - instanceGroupManagerPrototypeModel.AggregationWindow = core.Int64Ptr(int64(120)) - instanceGroupManagerPrototypeModel.Cooldown = core.Int64Ptr(int64(210)) - instanceGroupManagerPrototypeModel.ManagerType = core.StringPtr("autoscale") - instanceGroupManagerPrototypeModel.MaxMembershipCount = core.Int64Ptr(int64(10)) - instanceGroupManagerPrototypeModel.MinMembershipCount = core.Int64Ptr(int64(10)) + // Construct an instance of the InstanceTemplateIdentityByID model + instanceTemplateIdentityModel := new(vpcv1.InstanceTemplateIdentityByID) + instanceTemplateIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - // Construct an instance of the CreateInstanceGroupManagerOptions model - createInstanceGroupManagerOptionsModel := new(vpcv1.CreateInstanceGroupManagerOptions) - createInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") - createInstanceGroupManagerOptionsModel.InstanceGroupManagerPrototype = instanceGroupManagerPrototypeModel - createInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // 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 LoadBalancerIdentityByID model + loadBalancerIdentityModel := new(vpcv1.LoadBalancerIdentityByID) + loadBalancerIdentityModel.ID = core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727") + + // Construct an instance of the LoadBalancerPoolIdentityByID model + loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) + loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreateInstanceGroupOptions model + createInstanceGroupOptionsModel := new(vpcv1.CreateInstanceGroupOptions) + createInstanceGroupOptionsModel.InstanceTemplate = instanceTemplateIdentityModel + createInstanceGroupOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + createInstanceGroupOptionsModel.ApplicationPort = core.Int64Ptr(int64(22)) + createInstanceGroupOptionsModel.LoadBalancer = loadBalancerIdentityModel + createInstanceGroupOptionsModel.LoadBalancerPool = loadBalancerPoolIdentityModel + createInstanceGroupOptionsModel.MembershipCount = core.Int64Ptr(int64(10)) + createInstanceGroupOptionsModel.Name = core.StringPtr("my-instance-group") + createInstanceGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel + createInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.CreateInstanceGroupManager(createInstanceGroupManagerOptionsModel) + result, response, operationErr := vpcService.CreateInstanceGroup(createInstanceGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -29303,16 +29533,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteInstanceGroupManager(deleteInstanceGroupManagerOptions *DeleteInstanceGroupManagerOptions)`, func() { + Describe(`DeleteInstanceGroup(deleteInstanceGroupOptions *DeleteInstanceGroupOptions)`, func() { version := "testString" - deleteInstanceGroupManagerPath := "/instance_groups/testString/managers/testString" + deleteInstanceGroupPath := "/instance_groups/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(deleteInstanceGroupManagerPath)) + Expect(req.URL.EscapedPath()).To(Equal(deleteInstanceGroupPath)) Expect(req.Method).To(Equal("DELETE")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -29320,7 +29550,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(204) })) }) - It(`Invoke DeleteInstanceGroupManager successfully`, func() { + It(`Invoke DeleteInstanceGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -29330,22 +29560,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.DeleteInstanceGroupManager(nil) + response, operationErr := vpcService.DeleteInstanceGroup(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) - // Construct an instance of the DeleteInstanceGroupManagerOptions model - deleteInstanceGroupManagerOptionsModel := new(vpcv1.DeleteInstanceGroupManagerOptions) - deleteInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") - deleteInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") - deleteInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteInstanceGroupOptions model + deleteInstanceGroupOptionsModel := new(vpcv1.DeleteInstanceGroupOptions) + deleteInstanceGroupOptionsModel.ID = core.StringPtr("testString") + deleteInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteInstanceGroupManager(deleteInstanceGroupManagerOptionsModel) + response, operationErr = vpcService.DeleteInstanceGroup(deleteInstanceGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) }) - It(`Invoke DeleteInstanceGroupManager with error: Operation validation and request error`, func() { + It(`Invoke DeleteInstanceGroup with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -29354,22 +29583,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteInstanceGroupManagerOptions model - deleteInstanceGroupManagerOptionsModel := new(vpcv1.DeleteInstanceGroupManagerOptions) - deleteInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") - deleteInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") - deleteInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteInstanceGroupOptions model + deleteInstanceGroupOptionsModel := new(vpcv1.DeleteInstanceGroupOptions) + deleteInstanceGroupOptionsModel.ID = core.StringPtr("testString") + deleteInstanceGroupOptionsModel.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.DeleteInstanceGroupManager(deleteInstanceGroupManagerOptionsModel) + response, operationErr := vpcService.DeleteInstanceGroup(deleteInstanceGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - // Construct a second instance of the DeleteInstanceGroupManagerOptions model with no property values - deleteInstanceGroupManagerOptionsModelNew := new(vpcv1.DeleteInstanceGroupManagerOptions) + // Construct a second instance of the DeleteInstanceGroupOptions model with no property values + deleteInstanceGroupOptionsModelNew := new(vpcv1.DeleteInstanceGroupOptions) // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteInstanceGroupManager(deleteInstanceGroupManagerOptionsModelNew) + response, operationErr = vpcService.DeleteInstanceGroup(deleteInstanceGroupOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) }) @@ -29378,16 +29606,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetInstanceGroupManager(getInstanceGroupManagerOptions *GetInstanceGroupManagerOptions) - Operation response error`, func() { + Describe(`GetInstanceGroup(getInstanceGroupOptions *GetInstanceGroupOptions) - Operation response error`, func() { version := "testString" - getInstanceGroupManagerPath := "/instance_groups/testString/managers/testString" + getInstanceGroupPath := "/instance_groups/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(getInstanceGroupManagerPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupPath)) 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))})) @@ -29396,7 +29624,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetInstanceGroupManager with error: Operation response processing error`, func() { + It(`Invoke GetInstanceGroup with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -29405,20 +29633,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceGroupManagerOptions model - getInstanceGroupManagerOptionsModel := new(vpcv1.GetInstanceGroupManagerOptions) - getInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") - getInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupOptions model + getInstanceGroupOptionsModel := new(vpcv1.GetInstanceGroupOptions) + getInstanceGroupOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupOptionsModel.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.GetInstanceGroupManager(getInstanceGroupManagerOptionsModel) + result, response, operationErr := vpcService.GetInstanceGroup(getInstanceGroupOptionsModel) 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.GetInstanceGroupManager(getInstanceGroupManagerOptionsModel) + result, response, operationErr = vpcService.GetInstanceGroup(getInstanceGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -29428,16 +29655,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetInstanceGroupManager(getInstanceGroupManagerOptions *GetInstanceGroupManagerOptions)`, func() { + Describe(`GetInstanceGroup(getInstanceGroupOptions *GetInstanceGroupOptions)`, func() { version := "testString" - getInstanceGroupManagerPath := "/instance_groups/testString/managers/testString" + getInstanceGroupPath := "/instance_groups/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(getInstanceGroupManagerPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -29448,10 +29675,10 @@ 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/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "management_enabled": false, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy"}]}`) + fmt.Fprintf(res, "%s", `{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "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"}], "updated_at": "2019-01-01T12:00:00.000Z", "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 GetInstanceGroupManager successfully with retries`, func() { + It(`Invoke GetInstanceGroup successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -29461,22 +29688,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetInstanceGroupManagerOptions model - getInstanceGroupManagerOptionsModel := new(vpcv1.GetInstanceGroupManagerOptions) - getInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") - getInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupOptions model + getInstanceGroupOptionsModel := new(vpcv1.GetInstanceGroupOptions) + getInstanceGroupOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupOptionsModel.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.GetInstanceGroupManagerWithContext(ctx, getInstanceGroupManagerOptionsModel) + _, _, operationErr := vpcService.GetInstanceGroupWithContext(ctx, getInstanceGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetInstanceGroupManager(getInstanceGroupManagerOptionsModel) + result, response, operationErr := vpcService.GetInstanceGroup(getInstanceGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -29484,7 +29710,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetInstanceGroupManagerWithContext(ctx, getInstanceGroupManagerOptionsModel) + _, _, operationErr = vpcService.GetInstanceGroupWithContext(ctx, getInstanceGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -29498,7 +29724,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupManagerPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -29506,10 +29732,10 @@ 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/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "management_enabled": false, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy"}]}`) + fmt.Fprintf(res, "%s", `{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "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"}], "updated_at": "2019-01-01T12:00:00.000Z", "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 GetInstanceGroupManager successfully`, func() { + It(`Invoke GetInstanceGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -29519,25 +29745,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetInstanceGroupManager(nil) + result, response, operationErr := vpcService.GetInstanceGroup(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetInstanceGroupManagerOptions model - getInstanceGroupManagerOptionsModel := new(vpcv1.GetInstanceGroupManagerOptions) - getInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") - getInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupOptions model + getInstanceGroupOptionsModel := new(vpcv1.GetInstanceGroupOptions) + getInstanceGroupOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetInstanceGroupManager(getInstanceGroupManagerOptionsModel) + result, response, operationErr = vpcService.GetInstanceGroup(getInstanceGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetInstanceGroupManager with error: Operation validation and request error`, func() { + It(`Invoke GetInstanceGroup with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -29546,23 +29771,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceGroupManagerOptions model - getInstanceGroupManagerOptionsModel := new(vpcv1.GetInstanceGroupManagerOptions) - getInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") - getInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupOptions model + getInstanceGroupOptionsModel := new(vpcv1.GetInstanceGroupOptions) + getInstanceGroupOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupOptionsModel.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.GetInstanceGroupManager(getInstanceGroupManagerOptionsModel) + result, response, operationErr := vpcService.GetInstanceGroup(getInstanceGroupOptionsModel) 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 GetInstanceGroupManagerOptions model with no property values - getInstanceGroupManagerOptionsModelNew := new(vpcv1.GetInstanceGroupManagerOptions) + // Construct a second instance of the GetInstanceGroupOptions model with no property values + getInstanceGroupOptionsModelNew := new(vpcv1.GetInstanceGroupOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetInstanceGroupManager(getInstanceGroupManagerOptionsModelNew) + result, response, operationErr = vpcService.GetInstanceGroup(getInstanceGroupOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -29580,7 +29804,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetInstanceGroupManager successfully`, func() { + It(`Invoke GetInstanceGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -29589,14 +29813,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceGroupManagerOptions model - getInstanceGroupManagerOptionsModel := new(vpcv1.GetInstanceGroupManagerOptions) - getInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") - getInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupOptions model + getInstanceGroupOptionsModel := new(vpcv1.GetInstanceGroupOptions) + getInstanceGroupOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetInstanceGroupManager(getInstanceGroupManagerOptionsModel) + result, response, operationErr := vpcService.GetInstanceGroup(getInstanceGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -29608,16 +29831,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateInstanceGroupManager(updateInstanceGroupManagerOptions *UpdateInstanceGroupManagerOptions) - Operation response error`, func() { + Describe(`UpdateInstanceGroup(updateInstanceGroupOptions *UpdateInstanceGroupOptions) - Operation response error`, func() { version := "testString" - updateInstanceGroupManagerPath := "/instance_groups/testString/managers/testString" + updateInstanceGroupPath := "/instance_groups/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(updateInstanceGroupManagerPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupPath)) 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))})) @@ -29626,7 +29849,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateInstanceGroupManager with error: Operation response processing error`, func() { + It(`Invoke UpdateInstanceGroup with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -29635,32 +29858,48 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceGroupManagerPatch model - instanceGroupManagerPatchModel := new(vpcv1.InstanceGroupManagerPatch) - instanceGroupManagerPatchModel.AggregationWindow = core.Int64Ptr(int64(120)) - instanceGroupManagerPatchModel.Cooldown = core.Int64Ptr(int64(210)) - instanceGroupManagerPatchModel.ManagementEnabled = core.BoolPtr(true) - instanceGroupManagerPatchModel.MaxMembershipCount = core.Int64Ptr(int64(10)) - instanceGroupManagerPatchModel.MinMembershipCount = core.Int64Ptr(int64(10)) - instanceGroupManagerPatchModel.Name = core.StringPtr("my-instance-group-manager") - instanceGroupManagerPatchModelAsPatch, asPatchErr := instanceGroupManagerPatchModel.AsPatch() + // Construct an instance of the InstanceTemplateIdentityByID model + instanceTemplateIdentityModel := new(vpcv1.InstanceTemplateIdentityByID) + instanceTemplateIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") + + // Construct an instance of the LoadBalancerIdentityByID model + loadBalancerIdentityModel := new(vpcv1.LoadBalancerIdentityByID) + loadBalancerIdentityModel.ID = core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727") + + // Construct an instance of the LoadBalancerPoolIdentityByID model + loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) + loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // 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 InstanceGroupPatch model + instanceGroupPatchModel := new(vpcv1.InstanceGroupPatch) + instanceGroupPatchModel.ApplicationPort = core.Int64Ptr(int64(22)) + instanceGroupPatchModel.InstanceTemplate = instanceTemplateIdentityModel + instanceGroupPatchModel.LoadBalancer = loadBalancerIdentityModel + instanceGroupPatchModel.LoadBalancerPool = loadBalancerPoolIdentityModel + instanceGroupPatchModel.MembershipCount = core.Int64Ptr(int64(10)) + instanceGroupPatchModel.Name = core.StringPtr("my-instance-group") + instanceGroupPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + instanceGroupPatchModelAsPatch, asPatchErr := instanceGroupPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupManagerOptions model - updateInstanceGroupManagerOptionsModel := new(vpcv1.UpdateInstanceGroupManagerOptions) - updateInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") - updateInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupManagerOptionsModel.InstanceGroupManagerPatch = instanceGroupManagerPatchModelAsPatch - updateInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceGroupOptions model + updateInstanceGroupOptionsModel := new(vpcv1.UpdateInstanceGroupOptions) + updateInstanceGroupOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupOptionsModel.InstanceGroupPatch = instanceGroupPatchModelAsPatch + updateInstanceGroupOptionsModel.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.UpdateInstanceGroupManager(updateInstanceGroupManagerOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceGroup(updateInstanceGroupOptionsModel) 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.UpdateInstanceGroupManager(updateInstanceGroupManagerOptionsModel) + result, response, operationErr = vpcService.UpdateInstanceGroup(updateInstanceGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -29670,16 +29909,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateInstanceGroupManager(updateInstanceGroupManagerOptions *UpdateInstanceGroupManagerOptions)`, func() { + Describe(`UpdateInstanceGroup(updateInstanceGroupOptions *UpdateInstanceGroupOptions)`, func() { version := "testString" - updateInstanceGroupManagerPath := "/instance_groups/testString/managers/testString" + updateInstanceGroupPath := "/instance_groups/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(updateInstanceGroupManagerPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -29706,10 +29945,10 @@ 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/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "management_enabled": false, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy"}]}`) + fmt.Fprintf(res, "%s", `{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "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"}], "updated_at": "2019-01-01T12:00:00.000Z", "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 UpdateInstanceGroupManager successfully with retries`, func() { + It(`Invoke UpdateInstanceGroup successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -29719,34 +29958,50 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the InstanceGroupManagerPatch model - instanceGroupManagerPatchModel := new(vpcv1.InstanceGroupManagerPatch) - instanceGroupManagerPatchModel.AggregationWindow = core.Int64Ptr(int64(120)) - instanceGroupManagerPatchModel.Cooldown = core.Int64Ptr(int64(210)) - instanceGroupManagerPatchModel.ManagementEnabled = core.BoolPtr(true) - instanceGroupManagerPatchModel.MaxMembershipCount = core.Int64Ptr(int64(10)) - instanceGroupManagerPatchModel.MinMembershipCount = core.Int64Ptr(int64(10)) - instanceGroupManagerPatchModel.Name = core.StringPtr("my-instance-group-manager") - instanceGroupManagerPatchModelAsPatch, asPatchErr := instanceGroupManagerPatchModel.AsPatch() + // Construct an instance of the InstanceTemplateIdentityByID model + instanceTemplateIdentityModel := new(vpcv1.InstanceTemplateIdentityByID) + instanceTemplateIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") + + // Construct an instance of the LoadBalancerIdentityByID model + loadBalancerIdentityModel := new(vpcv1.LoadBalancerIdentityByID) + loadBalancerIdentityModel.ID = core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727") + + // Construct an instance of the LoadBalancerPoolIdentityByID model + loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) + loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // 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 InstanceGroupPatch model + instanceGroupPatchModel := new(vpcv1.InstanceGroupPatch) + instanceGroupPatchModel.ApplicationPort = core.Int64Ptr(int64(22)) + instanceGroupPatchModel.InstanceTemplate = instanceTemplateIdentityModel + instanceGroupPatchModel.LoadBalancer = loadBalancerIdentityModel + instanceGroupPatchModel.LoadBalancerPool = loadBalancerPoolIdentityModel + instanceGroupPatchModel.MembershipCount = core.Int64Ptr(int64(10)) + instanceGroupPatchModel.Name = core.StringPtr("my-instance-group") + instanceGroupPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + instanceGroupPatchModelAsPatch, asPatchErr := instanceGroupPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupManagerOptions model - updateInstanceGroupManagerOptionsModel := new(vpcv1.UpdateInstanceGroupManagerOptions) - updateInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") - updateInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupManagerOptionsModel.InstanceGroupManagerPatch = instanceGroupManagerPatchModelAsPatch - updateInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceGroupOptions model + updateInstanceGroupOptionsModel := new(vpcv1.UpdateInstanceGroupOptions) + updateInstanceGroupOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupOptionsModel.InstanceGroupPatch = instanceGroupPatchModelAsPatch + updateInstanceGroupOptionsModel.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.UpdateInstanceGroupManagerWithContext(ctx, updateInstanceGroupManagerOptionsModel) + _, _, operationErr := vpcService.UpdateInstanceGroupWithContext(ctx, updateInstanceGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateInstanceGroupManager(updateInstanceGroupManagerOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceGroup(updateInstanceGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -29754,7 +30009,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateInstanceGroupManagerWithContext(ctx, updateInstanceGroupManagerOptionsModel) + _, _, operationErr = vpcService.UpdateInstanceGroupWithContext(ctx, updateInstanceGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -29768,7 +30023,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupManagerPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -29792,10 +30047,10 @@ 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/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "management_enabled": false, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy"}]}`) + fmt.Fprintf(res, "%s", `{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-group:1e09281b-f177-46fb-baf1-bc152b2e391a", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "load_balancer_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "managers": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager"}], "membership_count": 10, "name": "my-instance-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "deleting", "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"}], "updated_at": "2019-01-01T12:00:00.000Z", "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 UpdateInstanceGroupManager successfully`, func() { + It(`Invoke UpdateInstanceGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -29805,37 +30060,53 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateInstanceGroupManager(nil) + result, response, operationErr := vpcService.UpdateInstanceGroup(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the InstanceGroupManagerPatch model - instanceGroupManagerPatchModel := new(vpcv1.InstanceGroupManagerPatch) - instanceGroupManagerPatchModel.AggregationWindow = core.Int64Ptr(int64(120)) - instanceGroupManagerPatchModel.Cooldown = core.Int64Ptr(int64(210)) - instanceGroupManagerPatchModel.ManagementEnabled = core.BoolPtr(true) - instanceGroupManagerPatchModel.MaxMembershipCount = core.Int64Ptr(int64(10)) - instanceGroupManagerPatchModel.MinMembershipCount = core.Int64Ptr(int64(10)) - instanceGroupManagerPatchModel.Name = core.StringPtr("my-instance-group-manager") - instanceGroupManagerPatchModelAsPatch, asPatchErr := instanceGroupManagerPatchModel.AsPatch() + // Construct an instance of the InstanceTemplateIdentityByID model + instanceTemplateIdentityModel := new(vpcv1.InstanceTemplateIdentityByID) + instanceTemplateIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") + + // Construct an instance of the LoadBalancerIdentityByID model + loadBalancerIdentityModel := new(vpcv1.LoadBalancerIdentityByID) + loadBalancerIdentityModel.ID = core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727") + + // Construct an instance of the LoadBalancerPoolIdentityByID model + loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) + loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // 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 InstanceGroupPatch model + instanceGroupPatchModel := new(vpcv1.InstanceGroupPatch) + instanceGroupPatchModel.ApplicationPort = core.Int64Ptr(int64(22)) + instanceGroupPatchModel.InstanceTemplate = instanceTemplateIdentityModel + instanceGroupPatchModel.LoadBalancer = loadBalancerIdentityModel + instanceGroupPatchModel.LoadBalancerPool = loadBalancerPoolIdentityModel + instanceGroupPatchModel.MembershipCount = core.Int64Ptr(int64(10)) + instanceGroupPatchModel.Name = core.StringPtr("my-instance-group") + instanceGroupPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + instanceGroupPatchModelAsPatch, asPatchErr := instanceGroupPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupManagerOptions model - updateInstanceGroupManagerOptionsModel := new(vpcv1.UpdateInstanceGroupManagerOptions) - updateInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") - updateInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupManagerOptionsModel.InstanceGroupManagerPatch = instanceGroupManagerPatchModelAsPatch - updateInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceGroupOptions model + updateInstanceGroupOptionsModel := new(vpcv1.UpdateInstanceGroupOptions) + updateInstanceGroupOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupOptionsModel.InstanceGroupPatch = instanceGroupPatchModelAsPatch + updateInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateInstanceGroupManager(updateInstanceGroupManagerOptionsModel) + result, response, operationErr = vpcService.UpdateInstanceGroup(updateInstanceGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateInstanceGroupManager with error: Operation validation and request error`, func() { + It(`Invoke UpdateInstanceGroup with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -29844,35 +30115,51 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceGroupManagerPatch model - instanceGroupManagerPatchModel := new(vpcv1.InstanceGroupManagerPatch) - instanceGroupManagerPatchModel.AggregationWindow = core.Int64Ptr(int64(120)) - instanceGroupManagerPatchModel.Cooldown = core.Int64Ptr(int64(210)) - instanceGroupManagerPatchModel.ManagementEnabled = core.BoolPtr(true) - instanceGroupManagerPatchModel.MaxMembershipCount = core.Int64Ptr(int64(10)) - instanceGroupManagerPatchModel.MinMembershipCount = core.Int64Ptr(int64(10)) - instanceGroupManagerPatchModel.Name = core.StringPtr("my-instance-group-manager") - instanceGroupManagerPatchModelAsPatch, asPatchErr := instanceGroupManagerPatchModel.AsPatch() + // Construct an instance of the InstanceTemplateIdentityByID model + instanceTemplateIdentityModel := new(vpcv1.InstanceTemplateIdentityByID) + instanceTemplateIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") + + // Construct an instance of the LoadBalancerIdentityByID model + loadBalancerIdentityModel := new(vpcv1.LoadBalancerIdentityByID) + loadBalancerIdentityModel.ID = core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727") + + // Construct an instance of the LoadBalancerPoolIdentityByID model + loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) + loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // 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 InstanceGroupPatch model + instanceGroupPatchModel := new(vpcv1.InstanceGroupPatch) + instanceGroupPatchModel.ApplicationPort = core.Int64Ptr(int64(22)) + instanceGroupPatchModel.InstanceTemplate = instanceTemplateIdentityModel + instanceGroupPatchModel.LoadBalancer = loadBalancerIdentityModel + instanceGroupPatchModel.LoadBalancerPool = loadBalancerPoolIdentityModel + instanceGroupPatchModel.MembershipCount = core.Int64Ptr(int64(10)) + instanceGroupPatchModel.Name = core.StringPtr("my-instance-group") + instanceGroupPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + instanceGroupPatchModelAsPatch, asPatchErr := instanceGroupPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupManagerOptions model - updateInstanceGroupManagerOptionsModel := new(vpcv1.UpdateInstanceGroupManagerOptions) - updateInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") - updateInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupManagerOptionsModel.InstanceGroupManagerPatch = instanceGroupManagerPatchModelAsPatch - updateInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceGroupOptions model + updateInstanceGroupOptionsModel := new(vpcv1.UpdateInstanceGroupOptions) + updateInstanceGroupOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupOptionsModel.InstanceGroupPatch = instanceGroupPatchModelAsPatch + updateInstanceGroupOptionsModel.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.UpdateInstanceGroupManager(updateInstanceGroupManagerOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceGroup(updateInstanceGroupOptionsModel) 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 UpdateInstanceGroupManagerOptions model with no property values - updateInstanceGroupManagerOptionsModelNew := new(vpcv1.UpdateInstanceGroupManagerOptions) + // Construct a second instance of the UpdateInstanceGroupOptions model with no property values + updateInstanceGroupOptionsModelNew := new(vpcv1.UpdateInstanceGroupOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateInstanceGroupManager(updateInstanceGroupManagerOptionsModelNew) + result, response, operationErr = vpcService.UpdateInstanceGroup(updateInstanceGroupOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -29890,7 +30177,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateInstanceGroupManager successfully`, func() { + It(`Invoke UpdateInstanceGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -29899,26 +30186,42 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceGroupManagerPatch model - instanceGroupManagerPatchModel := new(vpcv1.InstanceGroupManagerPatch) - instanceGroupManagerPatchModel.AggregationWindow = core.Int64Ptr(int64(120)) - instanceGroupManagerPatchModel.Cooldown = core.Int64Ptr(int64(210)) - instanceGroupManagerPatchModel.ManagementEnabled = core.BoolPtr(true) - instanceGroupManagerPatchModel.MaxMembershipCount = core.Int64Ptr(int64(10)) - instanceGroupManagerPatchModel.MinMembershipCount = core.Int64Ptr(int64(10)) - instanceGroupManagerPatchModel.Name = core.StringPtr("my-instance-group-manager") - instanceGroupManagerPatchModelAsPatch, asPatchErr := instanceGroupManagerPatchModel.AsPatch() + // Construct an instance of the InstanceTemplateIdentityByID model + instanceTemplateIdentityModel := new(vpcv1.InstanceTemplateIdentityByID) + instanceTemplateIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") + + // Construct an instance of the LoadBalancerIdentityByID model + loadBalancerIdentityModel := new(vpcv1.LoadBalancerIdentityByID) + loadBalancerIdentityModel.ID = core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727") + + // Construct an instance of the LoadBalancerPoolIdentityByID model + loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) + loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // 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 InstanceGroupPatch model + instanceGroupPatchModel := new(vpcv1.InstanceGroupPatch) + instanceGroupPatchModel.ApplicationPort = core.Int64Ptr(int64(22)) + instanceGroupPatchModel.InstanceTemplate = instanceTemplateIdentityModel + instanceGroupPatchModel.LoadBalancer = loadBalancerIdentityModel + instanceGroupPatchModel.LoadBalancerPool = loadBalancerPoolIdentityModel + instanceGroupPatchModel.MembershipCount = core.Int64Ptr(int64(10)) + instanceGroupPatchModel.Name = core.StringPtr("my-instance-group") + instanceGroupPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + instanceGroupPatchModelAsPatch, asPatchErr := instanceGroupPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupManagerOptions model - updateInstanceGroupManagerOptionsModel := new(vpcv1.UpdateInstanceGroupManagerOptions) - updateInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") - updateInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupManagerOptionsModel.InstanceGroupManagerPatch = instanceGroupManagerPatchModelAsPatch - updateInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceGroupOptions model + updateInstanceGroupOptionsModel := new(vpcv1.UpdateInstanceGroupOptions) + updateInstanceGroupOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupOptionsModel.InstanceGroupPatch = instanceGroupPatchModelAsPatch + updateInstanceGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.UpdateInstanceGroupManager(updateInstanceGroupManagerOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceGroup(updateInstanceGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -29930,16 +30233,89 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptions *ListInstanceGroupManagerActionsOptions) - Operation response error`, func() { + Describe(`DeleteInstanceGroupLoadBalancer(deleteInstanceGroupLoadBalancerOptions *DeleteInstanceGroupLoadBalancerOptions)`, func() { version := "testString" - listInstanceGroupManagerActionsPath := "/instance_groups/testString/managers/testString/actions" + deleteInstanceGroupLoadBalancerPath := "/instance_groups/testString/load_balancer" + 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(deleteInstanceGroupLoadBalancerPath)) + 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(204) + })) + }) + It(`Invoke DeleteInstanceGroupLoadBalancer 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.DeleteInstanceGroupLoadBalancer(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteInstanceGroupLoadBalancerOptions model + deleteInstanceGroupLoadBalancerOptionsModel := new(vpcv1.DeleteInstanceGroupLoadBalancerOptions) + deleteInstanceGroupLoadBalancerOptionsModel.InstanceGroupID = core.StringPtr("testString") + deleteInstanceGroupLoadBalancerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteInstanceGroupLoadBalancer(deleteInstanceGroupLoadBalancerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteInstanceGroupLoadBalancer 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 DeleteInstanceGroupLoadBalancerOptions model + deleteInstanceGroupLoadBalancerOptionsModel := new(vpcv1.DeleteInstanceGroupLoadBalancerOptions) + deleteInstanceGroupLoadBalancerOptionsModel.InstanceGroupID = core.StringPtr("testString") + deleteInstanceGroupLoadBalancerOptionsModel.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.DeleteInstanceGroupLoadBalancer(deleteInstanceGroupLoadBalancerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteInstanceGroupLoadBalancerOptions model with no property values + deleteInstanceGroupLoadBalancerOptionsModelNew := new(vpcv1.DeleteInstanceGroupLoadBalancerOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteInstanceGroupLoadBalancer(deleteInstanceGroupLoadBalancerOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListInstanceGroupManagers(listInstanceGroupManagersOptions *ListInstanceGroupManagersOptions) - Operation response error`, func() { + version := "testString" + listInstanceGroupManagersPath := "/instance_groups/testString/managers" 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(listInstanceGroupManagerActionsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupManagersPath)) 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))})) @@ -29950,7 +30326,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListInstanceGroupManagerActions with error: Operation response processing error`, func() { + It(`Invoke ListInstanceGroupManagers with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -29959,22 +30335,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceGroupManagerActionsOptions model - listInstanceGroupManagerActionsOptionsModel := new(vpcv1.ListInstanceGroupManagerActionsOptions) - listInstanceGroupManagerActionsOptionsModel.InstanceGroupID = core.StringPtr("testString") - listInstanceGroupManagerActionsOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - listInstanceGroupManagerActionsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagerActionsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupManagerActionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupManagersOptions model + listInstanceGroupManagersOptionsModel := new(vpcv1.ListInstanceGroupManagersOptions) + listInstanceGroupManagersOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupManagersOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupManagersOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupManagersOptionsModel.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.ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptionsModel) + result, response, operationErr := vpcService.ListInstanceGroupManagers(listInstanceGroupManagersOptionsModel) 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.ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptionsModel) + result, response, operationErr = vpcService.ListInstanceGroupManagers(listInstanceGroupManagersOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -29984,16 +30359,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptions *ListInstanceGroupManagerActionsOptions)`, func() { + Describe(`ListInstanceGroupManagers(listInstanceGroupManagersOptions *ListInstanceGroupManagersOptions)`, func() { version := "testString" - listInstanceGroupManagerActionsPath := "/instance_groups/testString/managers/testString/actions" + listInstanceGroupManagersPath := "/instance_groups/testString/managers" 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(listInstanceGroupManagerActionsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupManagersPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -30006,10 +30381,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"actions": [{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers?limit=20"}, "limit": 20, "managers": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "management_enabled": false, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy"}]}], "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) })) }) - It(`Invoke ListInstanceGroupManagerActions successfully with retries`, func() { + It(`Invoke ListInstanceGroupManagers successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -30019,24 +30394,23 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListInstanceGroupManagerActionsOptions model - listInstanceGroupManagerActionsOptionsModel := new(vpcv1.ListInstanceGroupManagerActionsOptions) - listInstanceGroupManagerActionsOptionsModel.InstanceGroupID = core.StringPtr("testString") - listInstanceGroupManagerActionsOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - listInstanceGroupManagerActionsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagerActionsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupManagerActionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupManagersOptions model + listInstanceGroupManagersOptionsModel := new(vpcv1.ListInstanceGroupManagersOptions) + listInstanceGroupManagersOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupManagersOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupManagersOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupManagersOptionsModel.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.ListInstanceGroupManagerActionsWithContext(ctx, listInstanceGroupManagerActionsOptionsModel) + _, _, operationErr := vpcService.ListInstanceGroupManagersWithContext(ctx, listInstanceGroupManagersOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptionsModel) + result, response, operationErr := vpcService.ListInstanceGroupManagers(listInstanceGroupManagersOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -30044,7 +30418,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListInstanceGroupManagerActionsWithContext(ctx, listInstanceGroupManagerActionsOptionsModel) + _, _, operationErr = vpcService.ListInstanceGroupManagersWithContext(ctx, listInstanceGroupManagersOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -30058,7 +30432,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupManagerActionsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupManagersPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -30068,10 +30442,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"actions": [{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers?limit=20"}, "limit": 20, "managers": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "management_enabled": false, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy"}]}], "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) })) }) - It(`Invoke ListInstanceGroupManagerActions successfully`, func() { + It(`Invoke ListInstanceGroupManagers successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -30081,27 +30455,26 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListInstanceGroupManagerActions(nil) + result, response, operationErr := vpcService.ListInstanceGroupManagers(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListInstanceGroupManagerActionsOptions model - listInstanceGroupManagerActionsOptionsModel := new(vpcv1.ListInstanceGroupManagerActionsOptions) - listInstanceGroupManagerActionsOptionsModel.InstanceGroupID = core.StringPtr("testString") - listInstanceGroupManagerActionsOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - listInstanceGroupManagerActionsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagerActionsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupManagerActionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupManagersOptions model + listInstanceGroupManagersOptionsModel := new(vpcv1.ListInstanceGroupManagersOptions) + listInstanceGroupManagersOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupManagersOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupManagersOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupManagersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptionsModel) + result, response, operationErr = vpcService.ListInstanceGroupManagers(listInstanceGroupManagersOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListInstanceGroupManagerActions with error: Operation validation and request error`, func() { + It(`Invoke ListInstanceGroupManagers with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -30110,25 +30483,24 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceGroupManagerActionsOptions model - listInstanceGroupManagerActionsOptionsModel := new(vpcv1.ListInstanceGroupManagerActionsOptions) - listInstanceGroupManagerActionsOptionsModel.InstanceGroupID = core.StringPtr("testString") - listInstanceGroupManagerActionsOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - listInstanceGroupManagerActionsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagerActionsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupManagerActionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupManagersOptions model + listInstanceGroupManagersOptionsModel := new(vpcv1.ListInstanceGroupManagersOptions) + listInstanceGroupManagersOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupManagersOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupManagersOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupManagersOptionsModel.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.ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptionsModel) + result, response, operationErr := vpcService.ListInstanceGroupManagers(listInstanceGroupManagersOptionsModel) 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 ListInstanceGroupManagerActionsOptions model with no property values - listInstanceGroupManagerActionsOptionsModelNew := new(vpcv1.ListInstanceGroupManagerActionsOptions) + // Construct a second instance of the ListInstanceGroupManagersOptions model with no property values + listInstanceGroupManagersOptionsModelNew := new(vpcv1.ListInstanceGroupManagersOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptionsModelNew) + result, response, operationErr = vpcService.ListInstanceGroupManagers(listInstanceGroupManagersOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -30146,7 +30518,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListInstanceGroupManagerActions successfully`, func() { + It(`Invoke ListInstanceGroupManagers successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -30155,16 +30527,15 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceGroupManagerActionsOptions model - listInstanceGroupManagerActionsOptionsModel := new(vpcv1.ListInstanceGroupManagerActionsOptions) - listInstanceGroupManagerActionsOptionsModel.InstanceGroupID = core.StringPtr("testString") - listInstanceGroupManagerActionsOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - listInstanceGroupManagerActionsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagerActionsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupManagerActionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupManagersOptions model + listInstanceGroupManagersOptionsModel := new(vpcv1.ListInstanceGroupManagersOptions) + listInstanceGroupManagersOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupManagersOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupManagersOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupManagersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptionsModel) + result, response, operationErr := vpcService.ListInstanceGroupManagers(listInstanceGroupManagersOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -30177,8 +30548,8 @@ var _ = Describe(`VpcV1`, func() { }) Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.InstanceGroupManagerActionsCollection) - nextObject := new(vpcv1.InstanceGroupManagerActionsCollectionNext) + responseObject := new(vpcv1.InstanceGroupManagerCollection) + nextObject := new(vpcv1.InstanceGroupManagerCollectionNext) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -30187,15 +30558,15 @@ var _ = Describe(`VpcV1`, func() { Expect(value).To(Equal(core.StringPtr("abc-123"))) }) It(`Invoke GetNextStart without a "Next" property in the response`, func() { - responseObject := new(vpcv1.InstanceGroupManagerActionsCollection) + responseObject := new(vpcv1.InstanceGroupManagerCollection) 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.InstanceGroupManagerActionsCollection) - nextObject := new(vpcv1.InstanceGroupManagerActionsCollectionNext) + responseObject := new(vpcv1.InstanceGroupManagerCollection) + nextObject := new(vpcv1.InstanceGroupManagerCollectionNext) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -30211,7 +30582,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupManagerActionsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupManagersPath)) Expect(req.Method).To(Equal("GET")) // Set mock response @@ -30219,15 +30590,15 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) requestNumber++ if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"actions":[{"auto_delete":true,"auto_delete_timeout":24,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance-group-manager-action","resource_type":"instance_group_manager_action","status":"active","updated_at":"2019-01-01T12:00:00.000Z","action_type":"scheduled","cron_spec":"30 */2 * * 1-5","last_applied_at":"2019-01-01T12:00:00.000Z","next_run_at":"2019-01-01T12:00:00.000Z","group":{"membership_count":10}}]}`) + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"managers":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","management_enabled":false,"name":"my-instance-group-manager","updated_at":"2019-01-01T12:00:00.000Z","aggregation_window":120,"cooldown":210,"manager_type":"autoscale","max_membership_count":10,"min_membership_count":10,"policies":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance-group-manager-policy"}]}]}`) } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"actions":[{"auto_delete":true,"auto_delete_timeout":24,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance-group-manager-action","resource_type":"instance_group_manager_action","status":"active","updated_at":"2019-01-01T12:00:00.000Z","action_type":"scheduled","cron_spec":"30 */2 * * 1-5","last_applied_at":"2019-01-01T12:00:00.000Z","next_run_at":"2019-01-01T12:00:00.000Z","group":{"membership_count":10}}]}`) + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"managers":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","management_enabled":false,"name":"my-instance-group-manager","updated_at":"2019-01-01T12:00:00.000Z","aggregation_window":120,"cooldown":210,"manager_type":"autoscale","max_membership_count":10,"min_membership_count":10,"policies":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance-group-manager-policy"}]}]}`) } else { res.WriteHeader(400) } })) }) - It(`Use InstanceGroupManagerActionsPager.GetNext successfully`, func() { + It(`Use InstanceGroupManagersPager.GetNext successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -30236,17 +30607,16 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listInstanceGroupManagerActionsOptionsModel := &vpcv1.ListInstanceGroupManagerActionsOptions{ - InstanceGroupID: core.StringPtr("testString"), - InstanceGroupManagerID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), + listInstanceGroupManagersOptionsModel := &vpcv1.ListInstanceGroupManagersOptions{ + InstanceGroupID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), } - pager, err := vpcService.NewInstanceGroupManagerActionsPager(listInstanceGroupManagerActionsOptionsModel) + pager, err := vpcService.NewInstanceGroupManagersPager(listInstanceGroupManagersOptionsModel) Expect(err).To(BeNil()) Expect(pager).ToNot(BeNil()) - var allResults []vpcv1.InstanceGroupManagerActionIntf + var allResults []vpcv1.InstanceGroupManagerIntf for pager.HasNext() { nextPage, err := pager.GetNext() Expect(err).To(BeNil()) @@ -30255,7 +30625,7 @@ var _ = Describe(`VpcV1`, func() { } Expect(len(allResults)).To(Equal(2)) }) - It(`Use InstanceGroupManagerActionsPager.GetAll successfully`, func() { + It(`Use InstanceGroupManagersPager.GetAll successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -30264,13 +30634,12 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listInstanceGroupManagerActionsOptionsModel := &vpcv1.ListInstanceGroupManagerActionsOptions{ - InstanceGroupID: core.StringPtr("testString"), - InstanceGroupManagerID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), + listInstanceGroupManagersOptionsModel := &vpcv1.ListInstanceGroupManagersOptions{ + InstanceGroupID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), } - pager, err := vpcService.NewInstanceGroupManagerActionsPager(listInstanceGroupManagerActionsOptionsModel) + pager, err := vpcService.NewInstanceGroupManagersPager(listInstanceGroupManagersOptionsModel) Expect(err).To(BeNil()) Expect(pager).ToNot(BeNil()) @@ -30281,16 +30650,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptions *CreateInstanceGroupManagerActionOptions) - Operation response error`, func() { + Describe(`CreateInstanceGroupManager(createInstanceGroupManagerOptions *CreateInstanceGroupManagerOptions) - Operation response error`, func() { version := "testString" - createInstanceGroupManagerActionPath := "/instance_groups/testString/managers/testString/actions" + createInstanceGroupManagerPath := "/instance_groups/testString/managers" 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(createInstanceGroupManagerActionPath)) + Expect(req.URL.EscapedPath()).To(Equal(createInstanceGroupManagerPath)) 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))})) @@ -30299,7 +30668,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateInstanceGroupManagerAction with error: Operation response processing error`, func() { + It(`Invoke CreateInstanceGroupManager with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -30308,31 +30677,30 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceGroupManagerScheduledActionGroupPrototype model - instanceGroupManagerScheduledActionGroupPrototypeModel := new(vpcv1.InstanceGroupManagerScheduledActionGroupPrototype) - instanceGroupManagerScheduledActionGroupPrototypeModel.MembershipCount = core.Int64Ptr(int64(10)) - - // Construct an instance of the InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup model - instanceGroupManagerActionPrototypeModel := new(vpcv1.InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup) - instanceGroupManagerActionPrototypeModel.Name = core.StringPtr("my-instance-group-manager-action") - instanceGroupManagerActionPrototypeModel.RunAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") - instanceGroupManagerActionPrototypeModel.Group = instanceGroupManagerScheduledActionGroupPrototypeModel + // Construct an instance of the InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype model + instanceGroupManagerPrototypeModel := new(vpcv1.InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype) + instanceGroupManagerPrototypeModel.ManagementEnabled = core.BoolPtr(true) + instanceGroupManagerPrototypeModel.Name = core.StringPtr("my-instance-group-manager") + instanceGroupManagerPrototypeModel.AggregationWindow = core.Int64Ptr(int64(120)) + instanceGroupManagerPrototypeModel.Cooldown = core.Int64Ptr(int64(210)) + instanceGroupManagerPrototypeModel.ManagerType = core.StringPtr("autoscale") + instanceGroupManagerPrototypeModel.MaxMembershipCount = core.Int64Ptr(int64(10)) + instanceGroupManagerPrototypeModel.MinMembershipCount = core.Int64Ptr(int64(10)) - // Construct an instance of the CreateInstanceGroupManagerActionOptions model - createInstanceGroupManagerActionOptionsModel := new(vpcv1.CreateInstanceGroupManagerActionOptions) - createInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") - createInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - createInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPrototype = instanceGroupManagerActionPrototypeModel - createInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateInstanceGroupManagerOptions model + createInstanceGroupManagerOptionsModel := new(vpcv1.CreateInstanceGroupManagerOptions) + createInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") + createInstanceGroupManagerOptionsModel.InstanceGroupManagerPrototype = instanceGroupManagerPrototypeModel + createInstanceGroupManagerOptionsModel.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.CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptionsModel) + result, response, operationErr := vpcService.CreateInstanceGroupManager(createInstanceGroupManagerOptionsModel) 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.CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptionsModel) + result, response, operationErr = vpcService.CreateInstanceGroupManager(createInstanceGroupManagerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -30342,16 +30710,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptions *CreateInstanceGroupManagerActionOptions)`, func() { + Describe(`CreateInstanceGroupManager(createInstanceGroupManagerOptions *CreateInstanceGroupManagerOptions)`, func() { version := "testString" - createInstanceGroupManagerActionPath := "/instance_groups/testString/managers/testString/actions" + createInstanceGroupManagerPath := "/instance_groups/testString/managers" 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(createInstanceGroupManagerActionPath)) + Expect(req.URL.EscapedPath()).To(Equal(createInstanceGroupManagerPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -30378,10 +30746,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "management_enabled": false, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy"}]}`) })) }) - It(`Invoke CreateInstanceGroupManagerAction successfully with retries`, func() { + It(`Invoke CreateInstanceGroupManager successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -30391,33 +30759,32 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the InstanceGroupManagerScheduledActionGroupPrototype model - instanceGroupManagerScheduledActionGroupPrototypeModel := new(vpcv1.InstanceGroupManagerScheduledActionGroupPrototype) - instanceGroupManagerScheduledActionGroupPrototypeModel.MembershipCount = core.Int64Ptr(int64(10)) - - // Construct an instance of the InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup model - instanceGroupManagerActionPrototypeModel := new(vpcv1.InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup) - instanceGroupManagerActionPrototypeModel.Name = core.StringPtr("my-instance-group-manager-action") - instanceGroupManagerActionPrototypeModel.RunAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") - instanceGroupManagerActionPrototypeModel.Group = instanceGroupManagerScheduledActionGroupPrototypeModel + // Construct an instance of the InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype model + instanceGroupManagerPrototypeModel := new(vpcv1.InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype) + instanceGroupManagerPrototypeModel.ManagementEnabled = core.BoolPtr(true) + instanceGroupManagerPrototypeModel.Name = core.StringPtr("my-instance-group-manager") + instanceGroupManagerPrototypeModel.AggregationWindow = core.Int64Ptr(int64(120)) + instanceGroupManagerPrototypeModel.Cooldown = core.Int64Ptr(int64(210)) + instanceGroupManagerPrototypeModel.ManagerType = core.StringPtr("autoscale") + instanceGroupManagerPrototypeModel.MaxMembershipCount = core.Int64Ptr(int64(10)) + instanceGroupManagerPrototypeModel.MinMembershipCount = core.Int64Ptr(int64(10)) - // Construct an instance of the CreateInstanceGroupManagerActionOptions model - createInstanceGroupManagerActionOptionsModel := new(vpcv1.CreateInstanceGroupManagerActionOptions) - createInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") - createInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - createInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPrototype = instanceGroupManagerActionPrototypeModel - createInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateInstanceGroupManagerOptions model + createInstanceGroupManagerOptionsModel := new(vpcv1.CreateInstanceGroupManagerOptions) + createInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") + createInstanceGroupManagerOptionsModel.InstanceGroupManagerPrototype = instanceGroupManagerPrototypeModel + createInstanceGroupManagerOptionsModel.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.CreateInstanceGroupManagerActionWithContext(ctx, createInstanceGroupManagerActionOptionsModel) + _, _, operationErr := vpcService.CreateInstanceGroupManagerWithContext(ctx, createInstanceGroupManagerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptionsModel) + result, response, operationErr := vpcService.CreateInstanceGroupManager(createInstanceGroupManagerOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -30425,7 +30792,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreateInstanceGroupManagerActionWithContext(ctx, createInstanceGroupManagerActionOptionsModel) + _, _, operationErr = vpcService.CreateInstanceGroupManagerWithContext(ctx, createInstanceGroupManagerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -30439,7 +30806,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createInstanceGroupManagerActionPath)) + Expect(req.URL.EscapedPath()).To(Equal(createInstanceGroupManagerPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -30463,10 +30830,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "management_enabled": false, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy"}]}`) })) }) - It(`Invoke CreateInstanceGroupManagerAction successfully`, func() { + It(`Invoke CreateInstanceGroupManager successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -30476,36 +30843,35 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreateInstanceGroupManagerAction(nil) + result, response, operationErr := vpcService.CreateInstanceGroupManager(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the InstanceGroupManagerScheduledActionGroupPrototype model - instanceGroupManagerScheduledActionGroupPrototypeModel := new(vpcv1.InstanceGroupManagerScheduledActionGroupPrototype) - instanceGroupManagerScheduledActionGroupPrototypeModel.MembershipCount = core.Int64Ptr(int64(10)) - - // Construct an instance of the InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup model - instanceGroupManagerActionPrototypeModel := new(vpcv1.InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup) - instanceGroupManagerActionPrototypeModel.Name = core.StringPtr("my-instance-group-manager-action") - instanceGroupManagerActionPrototypeModel.RunAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") - instanceGroupManagerActionPrototypeModel.Group = instanceGroupManagerScheduledActionGroupPrototypeModel + // Construct an instance of the InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype model + instanceGroupManagerPrototypeModel := new(vpcv1.InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype) + instanceGroupManagerPrototypeModel.ManagementEnabled = core.BoolPtr(true) + instanceGroupManagerPrototypeModel.Name = core.StringPtr("my-instance-group-manager") + instanceGroupManagerPrototypeModel.AggregationWindow = core.Int64Ptr(int64(120)) + instanceGroupManagerPrototypeModel.Cooldown = core.Int64Ptr(int64(210)) + instanceGroupManagerPrototypeModel.ManagerType = core.StringPtr("autoscale") + instanceGroupManagerPrototypeModel.MaxMembershipCount = core.Int64Ptr(int64(10)) + instanceGroupManagerPrototypeModel.MinMembershipCount = core.Int64Ptr(int64(10)) - // Construct an instance of the CreateInstanceGroupManagerActionOptions model - createInstanceGroupManagerActionOptionsModel := new(vpcv1.CreateInstanceGroupManagerActionOptions) - createInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") - createInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - createInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPrototype = instanceGroupManagerActionPrototypeModel - createInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateInstanceGroupManagerOptions model + createInstanceGroupManagerOptionsModel := new(vpcv1.CreateInstanceGroupManagerOptions) + createInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") + createInstanceGroupManagerOptionsModel.InstanceGroupManagerPrototype = instanceGroupManagerPrototypeModel + createInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptionsModel) + result, response, operationErr = vpcService.CreateInstanceGroupManager(createInstanceGroupManagerOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateInstanceGroupManagerAction with error: Operation validation and request error`, func() { + It(`Invoke CreateInstanceGroupManager with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -30514,34 +30880,33 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceGroupManagerScheduledActionGroupPrototype model - instanceGroupManagerScheduledActionGroupPrototypeModel := new(vpcv1.InstanceGroupManagerScheduledActionGroupPrototype) - instanceGroupManagerScheduledActionGroupPrototypeModel.MembershipCount = core.Int64Ptr(int64(10)) - - // Construct an instance of the InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup model - instanceGroupManagerActionPrototypeModel := new(vpcv1.InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup) - instanceGroupManagerActionPrototypeModel.Name = core.StringPtr("my-instance-group-manager-action") - instanceGroupManagerActionPrototypeModel.RunAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") - instanceGroupManagerActionPrototypeModel.Group = instanceGroupManagerScheduledActionGroupPrototypeModel + // Construct an instance of the InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype model + instanceGroupManagerPrototypeModel := new(vpcv1.InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype) + instanceGroupManagerPrototypeModel.ManagementEnabled = core.BoolPtr(true) + instanceGroupManagerPrototypeModel.Name = core.StringPtr("my-instance-group-manager") + instanceGroupManagerPrototypeModel.AggregationWindow = core.Int64Ptr(int64(120)) + instanceGroupManagerPrototypeModel.Cooldown = core.Int64Ptr(int64(210)) + instanceGroupManagerPrototypeModel.ManagerType = core.StringPtr("autoscale") + instanceGroupManagerPrototypeModel.MaxMembershipCount = core.Int64Ptr(int64(10)) + instanceGroupManagerPrototypeModel.MinMembershipCount = core.Int64Ptr(int64(10)) - // Construct an instance of the CreateInstanceGroupManagerActionOptions model - createInstanceGroupManagerActionOptionsModel := new(vpcv1.CreateInstanceGroupManagerActionOptions) - createInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") - createInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - createInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPrototype = instanceGroupManagerActionPrototypeModel - createInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateInstanceGroupManagerOptions model + createInstanceGroupManagerOptionsModel := new(vpcv1.CreateInstanceGroupManagerOptions) + createInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") + createInstanceGroupManagerOptionsModel.InstanceGroupManagerPrototype = instanceGroupManagerPrototypeModel + createInstanceGroupManagerOptionsModel.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.CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptionsModel) + result, response, operationErr := vpcService.CreateInstanceGroupManager(createInstanceGroupManagerOptionsModel) 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 CreateInstanceGroupManagerActionOptions model with no property values - createInstanceGroupManagerActionOptionsModelNew := new(vpcv1.CreateInstanceGroupManagerActionOptions) + // Construct a second instance of the CreateInstanceGroupManagerOptions model with no property values + createInstanceGroupManagerOptionsModelNew := new(vpcv1.CreateInstanceGroupManagerOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptionsModelNew) + result, response, operationErr = vpcService.CreateInstanceGroupManager(createInstanceGroupManagerOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -30559,7 +30924,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(201) })) }) - It(`Invoke CreateInstanceGroupManagerAction successfully`, func() { + It(`Invoke CreateInstanceGroupManager successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -30568,25 +30933,24 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceGroupManagerScheduledActionGroupPrototype model - instanceGroupManagerScheduledActionGroupPrototypeModel := new(vpcv1.InstanceGroupManagerScheduledActionGroupPrototype) - instanceGroupManagerScheduledActionGroupPrototypeModel.MembershipCount = core.Int64Ptr(int64(10)) - - // Construct an instance of the InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup model - instanceGroupManagerActionPrototypeModel := new(vpcv1.InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup) - instanceGroupManagerActionPrototypeModel.Name = core.StringPtr("my-instance-group-manager-action") - instanceGroupManagerActionPrototypeModel.RunAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") - instanceGroupManagerActionPrototypeModel.Group = instanceGroupManagerScheduledActionGroupPrototypeModel + // Construct an instance of the InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype model + instanceGroupManagerPrototypeModel := new(vpcv1.InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype) + instanceGroupManagerPrototypeModel.ManagementEnabled = core.BoolPtr(true) + instanceGroupManagerPrototypeModel.Name = core.StringPtr("my-instance-group-manager") + instanceGroupManagerPrototypeModel.AggregationWindow = core.Int64Ptr(int64(120)) + instanceGroupManagerPrototypeModel.Cooldown = core.Int64Ptr(int64(210)) + instanceGroupManagerPrototypeModel.ManagerType = core.StringPtr("autoscale") + instanceGroupManagerPrototypeModel.MaxMembershipCount = core.Int64Ptr(int64(10)) + instanceGroupManagerPrototypeModel.MinMembershipCount = core.Int64Ptr(int64(10)) - // Construct an instance of the CreateInstanceGroupManagerActionOptions model - createInstanceGroupManagerActionOptionsModel := new(vpcv1.CreateInstanceGroupManagerActionOptions) - createInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") - createInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - createInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPrototype = instanceGroupManagerActionPrototypeModel - createInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateInstanceGroupManagerOptions model + createInstanceGroupManagerOptionsModel := new(vpcv1.CreateInstanceGroupManagerOptions) + createInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") + createInstanceGroupManagerOptionsModel.InstanceGroupManagerPrototype = instanceGroupManagerPrototypeModel + createInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptionsModel) + result, response, operationErr := vpcService.CreateInstanceGroupManager(createInstanceGroupManagerOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -30598,16 +30962,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteInstanceGroupManagerAction(deleteInstanceGroupManagerActionOptions *DeleteInstanceGroupManagerActionOptions)`, func() { + Describe(`DeleteInstanceGroupManager(deleteInstanceGroupManagerOptions *DeleteInstanceGroupManagerOptions)`, func() { version := "testString" - deleteInstanceGroupManagerActionPath := "/instance_groups/testString/managers/testString/actions/testString" + deleteInstanceGroupManagerPath := "/instance_groups/testString/managers/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(deleteInstanceGroupManagerActionPath)) + Expect(req.URL.EscapedPath()).To(Equal(deleteInstanceGroupManagerPath)) Expect(req.Method).To(Equal("DELETE")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -30615,7 +30979,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(204) })) }) - It(`Invoke DeleteInstanceGroupManagerAction successfully`, func() { + It(`Invoke DeleteInstanceGroupManager successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -30625,23 +30989,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.DeleteInstanceGroupManagerAction(nil) + response, operationErr := vpcService.DeleteInstanceGroupManager(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) - // Construct an instance of the DeleteInstanceGroupManagerActionOptions model - deleteInstanceGroupManagerActionOptionsModel := new(vpcv1.DeleteInstanceGroupManagerActionOptions) - deleteInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") - deleteInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - deleteInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") - deleteInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteInstanceGroupManagerOptions model + deleteInstanceGroupManagerOptionsModel := new(vpcv1.DeleteInstanceGroupManagerOptions) + deleteInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") + deleteInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") + deleteInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteInstanceGroupManagerAction(deleteInstanceGroupManagerActionOptionsModel) + response, operationErr = vpcService.DeleteInstanceGroupManager(deleteInstanceGroupManagerOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) }) - It(`Invoke DeleteInstanceGroupManagerAction with error: Operation validation and request error`, func() { + It(`Invoke DeleteInstanceGroupManager with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -30650,23 +31013,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteInstanceGroupManagerActionOptions model - deleteInstanceGroupManagerActionOptionsModel := new(vpcv1.DeleteInstanceGroupManagerActionOptions) - deleteInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") - deleteInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - deleteInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") - deleteInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteInstanceGroupManagerOptions model + deleteInstanceGroupManagerOptionsModel := new(vpcv1.DeleteInstanceGroupManagerOptions) + deleteInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") + deleteInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") + deleteInstanceGroupManagerOptionsModel.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.DeleteInstanceGroupManagerAction(deleteInstanceGroupManagerActionOptionsModel) + response, operationErr := vpcService.DeleteInstanceGroupManager(deleteInstanceGroupManagerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - // Construct a second instance of the DeleteInstanceGroupManagerActionOptions model with no property values - deleteInstanceGroupManagerActionOptionsModelNew := new(vpcv1.DeleteInstanceGroupManagerActionOptions) + // Construct a second instance of the DeleteInstanceGroupManagerOptions model with no property values + deleteInstanceGroupManagerOptionsModelNew := new(vpcv1.DeleteInstanceGroupManagerOptions) // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteInstanceGroupManagerAction(deleteInstanceGroupManagerActionOptionsModelNew) + response, operationErr = vpcService.DeleteInstanceGroupManager(deleteInstanceGroupManagerOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) }) @@ -30675,16 +31037,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptions *GetInstanceGroupManagerActionOptions) - Operation response error`, func() { + Describe(`GetInstanceGroupManager(getInstanceGroupManagerOptions *GetInstanceGroupManagerOptions) - Operation response error`, func() { version := "testString" - getInstanceGroupManagerActionPath := "/instance_groups/testString/managers/testString/actions/testString" + getInstanceGroupManagerPath := "/instance_groups/testString/managers/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(getInstanceGroupManagerActionPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupManagerPath)) 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))})) @@ -30693,7 +31055,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetInstanceGroupManagerAction with error: Operation response processing error`, func() { + It(`Invoke GetInstanceGroupManager with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -30702,21 +31064,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceGroupManagerActionOptions model - getInstanceGroupManagerActionOptionsModel := new(vpcv1.GetInstanceGroupManagerActionOptions) - getInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") - getInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - getInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupManagerOptions model + getInstanceGroupManagerOptionsModel := new(vpcv1.GetInstanceGroupManagerOptions) + getInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") + getInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupManagerOptionsModel.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.GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptionsModel) + result, response, operationErr := vpcService.GetInstanceGroupManager(getInstanceGroupManagerOptionsModel) 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.GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptionsModel) + result, response, operationErr = vpcService.GetInstanceGroupManager(getInstanceGroupManagerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -30726,16 +31087,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptions *GetInstanceGroupManagerActionOptions)`, func() { + Describe(`GetInstanceGroupManager(getInstanceGroupManagerOptions *GetInstanceGroupManagerOptions)`, func() { version := "testString" - getInstanceGroupManagerActionPath := "/instance_groups/testString/managers/testString/actions/testString" + getInstanceGroupManagerPath := "/instance_groups/testString/managers/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(getInstanceGroupManagerActionPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupManagerPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -30746,10 +31107,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "management_enabled": false, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy"}]}`) })) }) - It(`Invoke GetInstanceGroupManagerAction successfully with retries`, func() { + It(`Invoke GetInstanceGroupManager successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -30759,23 +31120,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetInstanceGroupManagerActionOptions model - getInstanceGroupManagerActionOptionsModel := new(vpcv1.GetInstanceGroupManagerActionOptions) - getInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") - getInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - getInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupManagerOptions model + getInstanceGroupManagerOptionsModel := new(vpcv1.GetInstanceGroupManagerOptions) + getInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") + getInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupManagerOptionsModel.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.GetInstanceGroupManagerActionWithContext(ctx, getInstanceGroupManagerActionOptionsModel) + _, _, operationErr := vpcService.GetInstanceGroupManagerWithContext(ctx, getInstanceGroupManagerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptionsModel) + result, response, operationErr := vpcService.GetInstanceGroupManager(getInstanceGroupManagerOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -30783,7 +31143,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetInstanceGroupManagerActionWithContext(ctx, getInstanceGroupManagerActionOptionsModel) + _, _, operationErr = vpcService.GetInstanceGroupManagerWithContext(ctx, getInstanceGroupManagerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -30797,7 +31157,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupManagerActionPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupManagerPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -30805,10 +31165,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "management_enabled": false, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy"}]}`) })) }) - It(`Invoke GetInstanceGroupManagerAction successfully`, func() { + It(`Invoke GetInstanceGroupManager successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -30818,26 +31178,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetInstanceGroupManagerAction(nil) + result, response, operationErr := vpcService.GetInstanceGroupManager(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetInstanceGroupManagerActionOptions model - getInstanceGroupManagerActionOptionsModel := new(vpcv1.GetInstanceGroupManagerActionOptions) - getInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") - getInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - getInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupManagerOptions model + getInstanceGroupManagerOptionsModel := new(vpcv1.GetInstanceGroupManagerOptions) + getInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") + getInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptionsModel) + result, response, operationErr = vpcService.GetInstanceGroupManager(getInstanceGroupManagerOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetInstanceGroupManagerAction with error: Operation validation and request error`, func() { + It(`Invoke GetInstanceGroupManager with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -30846,24 +31205,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceGroupManagerActionOptions model - getInstanceGroupManagerActionOptionsModel := new(vpcv1.GetInstanceGroupManagerActionOptions) - getInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") - getInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - getInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupManagerOptions model + getInstanceGroupManagerOptionsModel := new(vpcv1.GetInstanceGroupManagerOptions) + getInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") + getInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupManagerOptionsModel.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.GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptionsModel) + result, response, operationErr := vpcService.GetInstanceGroupManager(getInstanceGroupManagerOptionsModel) 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 GetInstanceGroupManagerActionOptions model with no property values - getInstanceGroupManagerActionOptionsModelNew := new(vpcv1.GetInstanceGroupManagerActionOptions) + // Construct a second instance of the GetInstanceGroupManagerOptions model with no property values + getInstanceGroupManagerOptionsModelNew := new(vpcv1.GetInstanceGroupManagerOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptionsModelNew) + result, response, operationErr = vpcService.GetInstanceGroupManager(getInstanceGroupManagerOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -30881,7 +31239,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetInstanceGroupManagerAction successfully`, func() { + It(`Invoke GetInstanceGroupManager successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -30890,15 +31248,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceGroupManagerActionOptions model - getInstanceGroupManagerActionOptionsModel := new(vpcv1.GetInstanceGroupManagerActionOptions) - getInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") - getInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - getInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupManagerOptions model + getInstanceGroupManagerOptionsModel := new(vpcv1.GetInstanceGroupManagerOptions) + getInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") + getInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptionsModel) + result, response, operationErr := vpcService.GetInstanceGroupManager(getInstanceGroupManagerOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -30910,16 +31267,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptions *UpdateInstanceGroupManagerActionOptions) - Operation response error`, func() { + Describe(`UpdateInstanceGroupManager(updateInstanceGroupManagerOptions *UpdateInstanceGroupManagerOptions) - Operation response error`, func() { version := "testString" - updateInstanceGroupManagerActionPath := "/instance_groups/testString/managers/testString/actions/testString" + updateInstanceGroupManagerPath := "/instance_groups/testString/managers/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(updateInstanceGroupManagerActionPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupManagerPath)) 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))})) @@ -30928,7 +31285,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateInstanceGroupManagerAction with error: Operation response processing error`, func() { + It(`Invoke UpdateInstanceGroupManager with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -30937,41 +31294,32 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceGroupManagerActionGroupPatch model - instanceGroupManagerActionGroupPatchModel := new(vpcv1.InstanceGroupManagerActionGroupPatch) - instanceGroupManagerActionGroupPatchModel.MembershipCount = core.Int64Ptr(int64(10)) - - // Construct an instance of the InstanceGroupManagerActionManagerPatch model - instanceGroupManagerActionManagerPatchModel := new(vpcv1.InstanceGroupManagerActionManagerPatch) - instanceGroupManagerActionManagerPatchModel.MaxMembershipCount = core.Int64Ptr(int64(10)) - instanceGroupManagerActionManagerPatchModel.MinMembershipCount = core.Int64Ptr(int64(10)) - - // Construct an instance of the InstanceGroupManagerActionPatch model - instanceGroupManagerActionPatchModel := new(vpcv1.InstanceGroupManagerActionPatch) - instanceGroupManagerActionPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - instanceGroupManagerActionPatchModel.Group = instanceGroupManagerActionGroupPatchModel - instanceGroupManagerActionPatchModel.Manager = instanceGroupManagerActionManagerPatchModel - instanceGroupManagerActionPatchModel.Name = core.StringPtr("my-instance-group-manager-action") - instanceGroupManagerActionPatchModel.RunAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") - instanceGroupManagerActionPatchModelAsPatch, asPatchErr := instanceGroupManagerActionPatchModel.AsPatch() + // Construct an instance of the InstanceGroupManagerPatch model + instanceGroupManagerPatchModel := new(vpcv1.InstanceGroupManagerPatch) + instanceGroupManagerPatchModel.AggregationWindow = core.Int64Ptr(int64(120)) + instanceGroupManagerPatchModel.Cooldown = core.Int64Ptr(int64(210)) + instanceGroupManagerPatchModel.ManagementEnabled = core.BoolPtr(true) + instanceGroupManagerPatchModel.MaxMembershipCount = core.Int64Ptr(int64(10)) + instanceGroupManagerPatchModel.MinMembershipCount = core.Int64Ptr(int64(10)) + instanceGroupManagerPatchModel.Name = core.StringPtr("my-instance-group-manager") + instanceGroupManagerPatchModelAsPatch, asPatchErr := instanceGroupManagerPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupManagerActionOptions model - updateInstanceGroupManagerActionOptionsModel := new(vpcv1.UpdateInstanceGroupManagerActionOptions) - updateInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") - updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - updateInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPatch = instanceGroupManagerActionPatchModelAsPatch - updateInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceGroupManagerOptions model + updateInstanceGroupManagerOptionsModel := new(vpcv1.UpdateInstanceGroupManagerOptions) + updateInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") + updateInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupManagerOptionsModel.InstanceGroupManagerPatch = instanceGroupManagerPatchModelAsPatch + updateInstanceGroupManagerOptionsModel.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.UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceGroupManager(updateInstanceGroupManagerOptionsModel) 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.UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptionsModel) + result, response, operationErr = vpcService.UpdateInstanceGroupManager(updateInstanceGroupManagerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -30981,16 +31329,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptions *UpdateInstanceGroupManagerActionOptions)`, func() { + Describe(`UpdateInstanceGroupManager(updateInstanceGroupManagerOptions *UpdateInstanceGroupManagerOptions)`, func() { version := "testString" - updateInstanceGroupManagerActionPath := "/instance_groups/testString/managers/testString/actions/testString" + updateInstanceGroupManagerPath := "/instance_groups/testString/managers/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(updateInstanceGroupManagerActionPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupManagerPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -31017,10 +31365,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "management_enabled": false, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy"}]}`) })) }) - It(`Invoke UpdateInstanceGroupManagerAction successfully with retries`, func() { + It(`Invoke UpdateInstanceGroupManager successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -31030,43 +31378,34 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the InstanceGroupManagerActionGroupPatch model - instanceGroupManagerActionGroupPatchModel := new(vpcv1.InstanceGroupManagerActionGroupPatch) - instanceGroupManagerActionGroupPatchModel.MembershipCount = core.Int64Ptr(int64(10)) + // Construct an instance of the InstanceGroupManagerPatch model + instanceGroupManagerPatchModel := new(vpcv1.InstanceGroupManagerPatch) + instanceGroupManagerPatchModel.AggregationWindow = core.Int64Ptr(int64(120)) + instanceGroupManagerPatchModel.Cooldown = core.Int64Ptr(int64(210)) + instanceGroupManagerPatchModel.ManagementEnabled = core.BoolPtr(true) + instanceGroupManagerPatchModel.MaxMembershipCount = core.Int64Ptr(int64(10)) + instanceGroupManagerPatchModel.MinMembershipCount = core.Int64Ptr(int64(10)) + instanceGroupManagerPatchModel.Name = core.StringPtr("my-instance-group-manager") + instanceGroupManagerPatchModelAsPatch, asPatchErr := instanceGroupManagerPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) - // Construct an instance of the InstanceGroupManagerActionManagerPatch model - instanceGroupManagerActionManagerPatchModel := new(vpcv1.InstanceGroupManagerActionManagerPatch) - instanceGroupManagerActionManagerPatchModel.MaxMembershipCount = core.Int64Ptr(int64(10)) - instanceGroupManagerActionManagerPatchModel.MinMembershipCount = core.Int64Ptr(int64(10)) - - // Construct an instance of the InstanceGroupManagerActionPatch model - instanceGroupManagerActionPatchModel := new(vpcv1.InstanceGroupManagerActionPatch) - instanceGroupManagerActionPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - instanceGroupManagerActionPatchModel.Group = instanceGroupManagerActionGroupPatchModel - instanceGroupManagerActionPatchModel.Manager = instanceGroupManagerActionManagerPatchModel - instanceGroupManagerActionPatchModel.Name = core.StringPtr("my-instance-group-manager-action") - instanceGroupManagerActionPatchModel.RunAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") - instanceGroupManagerActionPatchModelAsPatch, asPatchErr := instanceGroupManagerActionPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateInstanceGroupManagerActionOptions model - updateInstanceGroupManagerActionOptionsModel := new(vpcv1.UpdateInstanceGroupManagerActionOptions) - updateInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") - updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - updateInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPatch = instanceGroupManagerActionPatchModelAsPatch - updateInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceGroupManagerOptions model + updateInstanceGroupManagerOptionsModel := new(vpcv1.UpdateInstanceGroupManagerOptions) + updateInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") + updateInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupManagerOptionsModel.InstanceGroupManagerPatch = instanceGroupManagerPatchModelAsPatch + updateInstanceGroupManagerOptionsModel.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.UpdateInstanceGroupManagerActionWithContext(ctx, updateInstanceGroupManagerActionOptionsModel) + _, _, operationErr := vpcService.UpdateInstanceGroupManagerWithContext(ctx, updateInstanceGroupManagerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceGroupManager(updateInstanceGroupManagerOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -31074,7 +31413,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateInstanceGroupManagerActionWithContext(ctx, updateInstanceGroupManagerActionOptionsModel) + _, _, operationErr = vpcService.UpdateInstanceGroupManagerWithContext(ctx, updateInstanceGroupManagerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -31088,7 +31427,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupManagerActionPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupManagerPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -31112,10 +31451,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "management_enabled": false, "name": "my-instance-group-manager", "updated_at": "2019-01-01T12:00:00.000Z", "aggregation_window": 120, "cooldown": 210, "manager_type": "autoscale", "max_membership_count": 10, "min_membership_count": 10, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy"}]}`) })) }) - It(`Invoke UpdateInstanceGroupManagerAction successfully`, func() { + It(`Invoke UpdateInstanceGroupManager successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -31125,46 +31464,37 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateInstanceGroupManagerAction(nil) + result, response, operationErr := vpcService.UpdateInstanceGroupManager(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the InstanceGroupManagerActionGroupPatch model - instanceGroupManagerActionGroupPatchModel := new(vpcv1.InstanceGroupManagerActionGroupPatch) - instanceGroupManagerActionGroupPatchModel.MembershipCount = core.Int64Ptr(int64(10)) - - // Construct an instance of the InstanceGroupManagerActionManagerPatch model - instanceGroupManagerActionManagerPatchModel := new(vpcv1.InstanceGroupManagerActionManagerPatch) - instanceGroupManagerActionManagerPatchModel.MaxMembershipCount = core.Int64Ptr(int64(10)) - instanceGroupManagerActionManagerPatchModel.MinMembershipCount = core.Int64Ptr(int64(10)) - - // Construct an instance of the InstanceGroupManagerActionPatch model - instanceGroupManagerActionPatchModel := new(vpcv1.InstanceGroupManagerActionPatch) - instanceGroupManagerActionPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - instanceGroupManagerActionPatchModel.Group = instanceGroupManagerActionGroupPatchModel - instanceGroupManagerActionPatchModel.Manager = instanceGroupManagerActionManagerPatchModel - instanceGroupManagerActionPatchModel.Name = core.StringPtr("my-instance-group-manager-action") - instanceGroupManagerActionPatchModel.RunAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") - instanceGroupManagerActionPatchModelAsPatch, asPatchErr := instanceGroupManagerActionPatchModel.AsPatch() + // Construct an instance of the InstanceGroupManagerPatch model + instanceGroupManagerPatchModel := new(vpcv1.InstanceGroupManagerPatch) + instanceGroupManagerPatchModel.AggregationWindow = core.Int64Ptr(int64(120)) + instanceGroupManagerPatchModel.Cooldown = core.Int64Ptr(int64(210)) + instanceGroupManagerPatchModel.ManagementEnabled = core.BoolPtr(true) + instanceGroupManagerPatchModel.MaxMembershipCount = core.Int64Ptr(int64(10)) + instanceGroupManagerPatchModel.MinMembershipCount = core.Int64Ptr(int64(10)) + instanceGroupManagerPatchModel.Name = core.StringPtr("my-instance-group-manager") + instanceGroupManagerPatchModelAsPatch, asPatchErr := instanceGroupManagerPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupManagerActionOptions model - updateInstanceGroupManagerActionOptionsModel := new(vpcv1.UpdateInstanceGroupManagerActionOptions) - updateInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") - updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - updateInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPatch = instanceGroupManagerActionPatchModelAsPatch - updateInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceGroupManagerOptions model + updateInstanceGroupManagerOptionsModel := new(vpcv1.UpdateInstanceGroupManagerOptions) + updateInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") + updateInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupManagerOptionsModel.InstanceGroupManagerPatch = instanceGroupManagerPatchModelAsPatch + updateInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptionsModel) + result, response, operationErr = vpcService.UpdateInstanceGroupManager(updateInstanceGroupManagerOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateInstanceGroupManagerAction with error: Operation validation and request error`, func() { + It(`Invoke UpdateInstanceGroupManager with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -31173,44 +31503,35 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceGroupManagerActionGroupPatch model - instanceGroupManagerActionGroupPatchModel := new(vpcv1.InstanceGroupManagerActionGroupPatch) - instanceGroupManagerActionGroupPatchModel.MembershipCount = core.Int64Ptr(int64(10)) - - // Construct an instance of the InstanceGroupManagerActionManagerPatch model - instanceGroupManagerActionManagerPatchModel := new(vpcv1.InstanceGroupManagerActionManagerPatch) - instanceGroupManagerActionManagerPatchModel.MaxMembershipCount = core.Int64Ptr(int64(10)) - instanceGroupManagerActionManagerPatchModel.MinMembershipCount = core.Int64Ptr(int64(10)) - - // Construct an instance of the InstanceGroupManagerActionPatch model - instanceGroupManagerActionPatchModel := new(vpcv1.InstanceGroupManagerActionPatch) - instanceGroupManagerActionPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - instanceGroupManagerActionPatchModel.Group = instanceGroupManagerActionGroupPatchModel - instanceGroupManagerActionPatchModel.Manager = instanceGroupManagerActionManagerPatchModel - instanceGroupManagerActionPatchModel.Name = core.StringPtr("my-instance-group-manager-action") - instanceGroupManagerActionPatchModel.RunAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") - instanceGroupManagerActionPatchModelAsPatch, asPatchErr := instanceGroupManagerActionPatchModel.AsPatch() + // Construct an instance of the InstanceGroupManagerPatch model + instanceGroupManagerPatchModel := new(vpcv1.InstanceGroupManagerPatch) + instanceGroupManagerPatchModel.AggregationWindow = core.Int64Ptr(int64(120)) + instanceGroupManagerPatchModel.Cooldown = core.Int64Ptr(int64(210)) + instanceGroupManagerPatchModel.ManagementEnabled = core.BoolPtr(true) + instanceGroupManagerPatchModel.MaxMembershipCount = core.Int64Ptr(int64(10)) + instanceGroupManagerPatchModel.MinMembershipCount = core.Int64Ptr(int64(10)) + instanceGroupManagerPatchModel.Name = core.StringPtr("my-instance-group-manager") + instanceGroupManagerPatchModelAsPatch, asPatchErr := instanceGroupManagerPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupManagerActionOptions model - updateInstanceGroupManagerActionOptionsModel := new(vpcv1.UpdateInstanceGroupManagerActionOptions) - updateInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") - updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - updateInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPatch = instanceGroupManagerActionPatchModelAsPatch - updateInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceGroupManagerOptions model + updateInstanceGroupManagerOptionsModel := new(vpcv1.UpdateInstanceGroupManagerOptions) + updateInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") + updateInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupManagerOptionsModel.InstanceGroupManagerPatch = instanceGroupManagerPatchModelAsPatch + updateInstanceGroupManagerOptionsModel.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.UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceGroupManager(updateInstanceGroupManagerOptionsModel) 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 UpdateInstanceGroupManagerActionOptions model with no property values - updateInstanceGroupManagerActionOptionsModelNew := new(vpcv1.UpdateInstanceGroupManagerActionOptions) + // Construct a second instance of the UpdateInstanceGroupManagerOptions model with no property values + updateInstanceGroupManagerOptionsModelNew := new(vpcv1.UpdateInstanceGroupManagerOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptionsModelNew) + result, response, operationErr = vpcService.UpdateInstanceGroupManager(updateInstanceGroupManagerOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -31228,7 +31549,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateInstanceGroupManagerAction successfully`, func() { + It(`Invoke UpdateInstanceGroupManager successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -31237,35 +31558,26 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceGroupManagerActionGroupPatch model - instanceGroupManagerActionGroupPatchModel := new(vpcv1.InstanceGroupManagerActionGroupPatch) - instanceGroupManagerActionGroupPatchModel.MembershipCount = core.Int64Ptr(int64(10)) - - // Construct an instance of the InstanceGroupManagerActionManagerPatch model - instanceGroupManagerActionManagerPatchModel := new(vpcv1.InstanceGroupManagerActionManagerPatch) - instanceGroupManagerActionManagerPatchModel.MaxMembershipCount = core.Int64Ptr(int64(10)) - instanceGroupManagerActionManagerPatchModel.MinMembershipCount = core.Int64Ptr(int64(10)) - - // Construct an instance of the InstanceGroupManagerActionPatch model - instanceGroupManagerActionPatchModel := new(vpcv1.InstanceGroupManagerActionPatch) - instanceGroupManagerActionPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - instanceGroupManagerActionPatchModel.Group = instanceGroupManagerActionGroupPatchModel - instanceGroupManagerActionPatchModel.Manager = instanceGroupManagerActionManagerPatchModel - instanceGroupManagerActionPatchModel.Name = core.StringPtr("my-instance-group-manager-action") - instanceGroupManagerActionPatchModel.RunAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") - instanceGroupManagerActionPatchModelAsPatch, asPatchErr := instanceGroupManagerActionPatchModel.AsPatch() + // Construct an instance of the InstanceGroupManagerPatch model + instanceGroupManagerPatchModel := new(vpcv1.InstanceGroupManagerPatch) + instanceGroupManagerPatchModel.AggregationWindow = core.Int64Ptr(int64(120)) + instanceGroupManagerPatchModel.Cooldown = core.Int64Ptr(int64(210)) + instanceGroupManagerPatchModel.ManagementEnabled = core.BoolPtr(true) + instanceGroupManagerPatchModel.MaxMembershipCount = core.Int64Ptr(int64(10)) + instanceGroupManagerPatchModel.MinMembershipCount = core.Int64Ptr(int64(10)) + instanceGroupManagerPatchModel.Name = core.StringPtr("my-instance-group-manager") + instanceGroupManagerPatchModelAsPatch, asPatchErr := instanceGroupManagerPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupManagerActionOptions model - updateInstanceGroupManagerActionOptionsModel := new(vpcv1.UpdateInstanceGroupManagerActionOptions) - updateInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") - updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - updateInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPatch = instanceGroupManagerActionPatchModelAsPatch - updateInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceGroupManagerOptions model + updateInstanceGroupManagerOptionsModel := new(vpcv1.UpdateInstanceGroupManagerOptions) + updateInstanceGroupManagerOptionsModel.InstanceGroupID = core.StringPtr("testString") + updateInstanceGroupManagerOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupManagerOptionsModel.InstanceGroupManagerPatch = instanceGroupManagerPatchModelAsPatch + updateInstanceGroupManagerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceGroupManager(updateInstanceGroupManagerOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -31277,16 +31589,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptions *ListInstanceGroupManagerPoliciesOptions) - Operation response error`, func() { + Describe(`ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptions *ListInstanceGroupManagerActionsOptions) - Operation response error`, func() { version := "testString" - listInstanceGroupManagerPoliciesPath := "/instance_groups/testString/managers/testString/policies" + listInstanceGroupManagerActionsPath := "/instance_groups/testString/managers/testString/actions" 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(listInstanceGroupManagerPoliciesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupManagerActionsPath)) 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))})) @@ -31297,7 +31609,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListInstanceGroupManagerPolicies with error: Operation response processing error`, func() { + It(`Invoke ListInstanceGroupManagerActions with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -31306,22 +31618,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceGroupManagerPoliciesOptions model - listInstanceGroupManagerPoliciesOptionsModel := new(vpcv1.ListInstanceGroupManagerPoliciesOptions) - listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupID = core.StringPtr("testString") - listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - listInstanceGroupManagerPoliciesOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagerPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupManagerPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupManagerActionsOptions model + listInstanceGroupManagerActionsOptionsModel := new(vpcv1.ListInstanceGroupManagerActionsOptions) + listInstanceGroupManagerActionsOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupManagerActionsOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + listInstanceGroupManagerActionsOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupManagerActionsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupManagerActionsOptionsModel.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.ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptionsModel) + result, response, operationErr := vpcService.ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptionsModel) 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.ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptionsModel) + result, response, operationErr = vpcService.ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -31331,16 +31643,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptions *ListInstanceGroupManagerPoliciesOptions)`, func() { + Describe(`ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptions *ListInstanceGroupManagerActionsOptions)`, func() { version := "testString" - listInstanceGroupManagerPoliciesPath := "/instance_groups/testString/managers/testString/policies" + listInstanceGroupManagerActionsPath := "/instance_groups/testString/managers/testString/actions" 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(listInstanceGroupManagerPoliciesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupManagerActionsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -31353,10 +31665,10 @@ 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/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "policies": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 11, "policy_type": "target"}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"actions": [{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) })) }) - It(`Invoke ListInstanceGroupManagerPolicies successfully with retries`, func() { + It(`Invoke ListInstanceGroupManagerActions successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -31366,24 +31678,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListInstanceGroupManagerPoliciesOptions model - listInstanceGroupManagerPoliciesOptionsModel := new(vpcv1.ListInstanceGroupManagerPoliciesOptions) - listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupID = core.StringPtr("testString") - listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - listInstanceGroupManagerPoliciesOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagerPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupManagerPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupManagerActionsOptions model + listInstanceGroupManagerActionsOptionsModel := new(vpcv1.ListInstanceGroupManagerActionsOptions) + listInstanceGroupManagerActionsOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupManagerActionsOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + listInstanceGroupManagerActionsOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupManagerActionsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupManagerActionsOptionsModel.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.ListInstanceGroupManagerPoliciesWithContext(ctx, listInstanceGroupManagerPoliciesOptionsModel) + _, _, operationErr := vpcService.ListInstanceGroupManagerActionsWithContext(ctx, listInstanceGroupManagerActionsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptionsModel) + result, response, operationErr := vpcService.ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -31391,7 +31703,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListInstanceGroupManagerPoliciesWithContext(ctx, listInstanceGroupManagerPoliciesOptionsModel) + _, _, operationErr = vpcService.ListInstanceGroupManagerActionsWithContext(ctx, listInstanceGroupManagerActionsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -31405,7 +31717,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupManagerPoliciesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupManagerActionsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -31415,10 +31727,10 @@ 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/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "policies": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 11, "policy_type": "target"}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"actions": [{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) })) }) - It(`Invoke ListInstanceGroupManagerPolicies successfully`, func() { + It(`Invoke ListInstanceGroupManagerActions successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -31428,27 +31740,27 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListInstanceGroupManagerPolicies(nil) + result, response, operationErr := vpcService.ListInstanceGroupManagerActions(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListInstanceGroupManagerPoliciesOptions model - listInstanceGroupManagerPoliciesOptionsModel := new(vpcv1.ListInstanceGroupManagerPoliciesOptions) - listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupID = core.StringPtr("testString") - listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - listInstanceGroupManagerPoliciesOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagerPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupManagerPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupManagerActionsOptions model + listInstanceGroupManagerActionsOptionsModel := new(vpcv1.ListInstanceGroupManagerActionsOptions) + listInstanceGroupManagerActionsOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupManagerActionsOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + listInstanceGroupManagerActionsOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupManagerActionsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupManagerActionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptionsModel) + result, response, operationErr = vpcService.ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListInstanceGroupManagerPolicies with error: Operation validation and request error`, func() { + It(`Invoke ListInstanceGroupManagerActions with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -31457,25 +31769,25 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceGroupManagerPoliciesOptions model - listInstanceGroupManagerPoliciesOptionsModel := new(vpcv1.ListInstanceGroupManagerPoliciesOptions) - listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupID = core.StringPtr("testString") - listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - listInstanceGroupManagerPoliciesOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagerPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupManagerPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupManagerActionsOptions model + listInstanceGroupManagerActionsOptionsModel := new(vpcv1.ListInstanceGroupManagerActionsOptions) + listInstanceGroupManagerActionsOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupManagerActionsOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + listInstanceGroupManagerActionsOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupManagerActionsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupManagerActionsOptionsModel.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.ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptionsModel) + result, response, operationErr := vpcService.ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptionsModel) 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 ListInstanceGroupManagerPoliciesOptions model with no property values - listInstanceGroupManagerPoliciesOptionsModelNew := new(vpcv1.ListInstanceGroupManagerPoliciesOptions) + // Construct a second instance of the ListInstanceGroupManagerActionsOptions model with no property values + listInstanceGroupManagerActionsOptionsModelNew := new(vpcv1.ListInstanceGroupManagerActionsOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptionsModelNew) + result, response, operationErr = vpcService.ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -31493,7 +31805,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListInstanceGroupManagerPolicies successfully`, func() { + It(`Invoke ListInstanceGroupManagerActions successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -31502,16 +31814,16 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceGroupManagerPoliciesOptions model - listInstanceGroupManagerPoliciesOptionsModel := new(vpcv1.ListInstanceGroupManagerPoliciesOptions) - listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupID = core.StringPtr("testString") - listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - listInstanceGroupManagerPoliciesOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagerPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupManagerPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupManagerActionsOptions model + listInstanceGroupManagerActionsOptionsModel := new(vpcv1.ListInstanceGroupManagerActionsOptions) + listInstanceGroupManagerActionsOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupManagerActionsOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + listInstanceGroupManagerActionsOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupManagerActionsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupManagerActionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptionsModel) + result, response, operationErr := vpcService.ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -31524,8 +31836,8 @@ var _ = Describe(`VpcV1`, func() { }) Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.InstanceGroupManagerPolicyCollection) - nextObject := new(vpcv1.InstanceGroupManagerPolicyCollectionNext) + responseObject := new(vpcv1.InstanceGroupManagerActionsCollection) + nextObject := new(vpcv1.InstanceGroupManagerActionsCollectionNext) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -31534,15 +31846,15 @@ var _ = Describe(`VpcV1`, func() { Expect(value).To(Equal(core.StringPtr("abc-123"))) }) It(`Invoke GetNextStart without a "Next" property in the response`, func() { - responseObject := new(vpcv1.InstanceGroupManagerPolicyCollection) + responseObject := new(vpcv1.InstanceGroupManagerActionsCollection) 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.InstanceGroupManagerPolicyCollection) - nextObject := new(vpcv1.InstanceGroupManagerPolicyCollectionNext) + responseObject := new(vpcv1.InstanceGroupManagerActionsCollection) + nextObject := new(vpcv1.InstanceGroupManagerActionsCollectionNext) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -31558,7 +31870,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupManagerPoliciesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupManagerActionsPath)) Expect(req.Method).To(Equal("GET")) // Set mock response @@ -31566,15 +31878,15 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) requestNumber++ if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"policies":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance-group-manager-policy","updated_at":"2019-01-01T12:00:00.000Z","metric_type":"cpu","metric_value":11,"policy_type":"target"}]}`) + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"actions":[{"auto_delete":true,"auto_delete_timeout":24,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance-group-manager-action","resource_type":"instance_group_manager_action","status":"active","updated_at":"2019-01-01T12:00:00.000Z","action_type":"scheduled","cron_spec":"30 */2 * * 1-5","last_applied_at":"2019-01-01T12:00:00.000Z","next_run_at":"2019-01-01T12:00:00.000Z","group":{"membership_count":10}}]}`) } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"policies":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance-group-manager-policy","updated_at":"2019-01-01T12:00:00.000Z","metric_type":"cpu","metric_value":11,"policy_type":"target"}]}`) + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"actions":[{"auto_delete":true,"auto_delete_timeout":24,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance-group-manager-action","resource_type":"instance_group_manager_action","status":"active","updated_at":"2019-01-01T12:00:00.000Z","action_type":"scheduled","cron_spec":"30 */2 * * 1-5","last_applied_at":"2019-01-01T12:00:00.000Z","next_run_at":"2019-01-01T12:00:00.000Z","group":{"membership_count":10}}]}`) } else { res.WriteHeader(400) } })) }) - It(`Use InstanceGroupManagerPoliciesPager.GetNext successfully`, func() { + It(`Use InstanceGroupManagerActionsPager.GetNext successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -31583,17 +31895,17 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listInstanceGroupManagerPoliciesOptionsModel := &vpcv1.ListInstanceGroupManagerPoliciesOptions{ + listInstanceGroupManagerActionsOptionsModel := &vpcv1.ListInstanceGroupManagerActionsOptions{ InstanceGroupID: core.StringPtr("testString"), InstanceGroupManagerID: core.StringPtr("testString"), Limit: core.Int64Ptr(int64(10)), } - pager, err := vpcService.NewInstanceGroupManagerPoliciesPager(listInstanceGroupManagerPoliciesOptionsModel) + pager, err := vpcService.NewInstanceGroupManagerActionsPager(listInstanceGroupManagerActionsOptionsModel) Expect(err).To(BeNil()) Expect(pager).ToNot(BeNil()) - var allResults []vpcv1.InstanceGroupManagerPolicyIntf + var allResults []vpcv1.InstanceGroupManagerActionIntf for pager.HasNext() { nextPage, err := pager.GetNext() Expect(err).To(BeNil()) @@ -31602,7 +31914,7 @@ var _ = Describe(`VpcV1`, func() { } Expect(len(allResults)).To(Equal(2)) }) - It(`Use InstanceGroupManagerPoliciesPager.GetAll successfully`, func() { + It(`Use InstanceGroupManagerActionsPager.GetAll successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -31611,13 +31923,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listInstanceGroupManagerPoliciesOptionsModel := &vpcv1.ListInstanceGroupManagerPoliciesOptions{ + listInstanceGroupManagerActionsOptionsModel := &vpcv1.ListInstanceGroupManagerActionsOptions{ InstanceGroupID: core.StringPtr("testString"), InstanceGroupManagerID: core.StringPtr("testString"), Limit: core.Int64Ptr(int64(10)), } - pager, err := vpcService.NewInstanceGroupManagerPoliciesPager(listInstanceGroupManagerPoliciesOptionsModel) + pager, err := vpcService.NewInstanceGroupManagerActionsPager(listInstanceGroupManagerActionsOptionsModel) Expect(err).To(BeNil()) Expect(pager).ToNot(BeNil()) @@ -31628,16 +31940,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptions *CreateInstanceGroupManagerPolicyOptions) - Operation response error`, func() { + Describe(`CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptions *CreateInstanceGroupManagerActionOptions) - Operation response error`, func() { version := "testString" - createInstanceGroupManagerPolicyPath := "/instance_groups/testString/managers/testString/policies" + createInstanceGroupManagerActionPath := "/instance_groups/testString/managers/testString/actions" 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(createInstanceGroupManagerPolicyPath)) + Expect(req.URL.EscapedPath()).To(Equal(createInstanceGroupManagerActionPath)) 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))})) @@ -31646,7 +31958,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateInstanceGroupManagerPolicy with error: Operation response processing error`, func() { + It(`Invoke CreateInstanceGroupManagerAction with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -31655,28 +31967,31 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype model - instanceGroupManagerPolicyPrototypeModel := new(vpcv1.InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype) - instanceGroupManagerPolicyPrototypeModel.Name = core.StringPtr("my-instance-group-manager-policy") - instanceGroupManagerPolicyPrototypeModel.MetricType = core.StringPtr("cpu") - instanceGroupManagerPolicyPrototypeModel.MetricValue = core.Int64Ptr(int64(38)) - instanceGroupManagerPolicyPrototypeModel.PolicyType = core.StringPtr("target") + // Construct an instance of the InstanceGroupManagerScheduledActionGroupPrototype model + instanceGroupManagerScheduledActionGroupPrototypeModel := new(vpcv1.InstanceGroupManagerScheduledActionGroupPrototype) + instanceGroupManagerScheduledActionGroupPrototypeModel.MembershipCount = core.Int64Ptr(int64(10)) - // Construct an instance of the CreateInstanceGroupManagerPolicyOptions model - createInstanceGroupManagerPolicyOptionsModel := new(vpcv1.CreateInstanceGroupManagerPolicyOptions) - createInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") - createInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - createInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPrototype = instanceGroupManagerPolicyPrototypeModel - createInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup model + instanceGroupManagerActionPrototypeModel := new(vpcv1.InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup) + instanceGroupManagerActionPrototypeModel.Name = core.StringPtr("my-instance-group-manager-action") + instanceGroupManagerActionPrototypeModel.RunAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + instanceGroupManagerActionPrototypeModel.Group = instanceGroupManagerScheduledActionGroupPrototypeModel + + // Construct an instance of the CreateInstanceGroupManagerActionOptions model + createInstanceGroupManagerActionOptionsModel := new(vpcv1.CreateInstanceGroupManagerActionOptions) + createInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") + createInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + createInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPrototype = instanceGroupManagerActionPrototypeModel + createInstanceGroupManagerActionOptionsModel.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.CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptionsModel) + result, response, operationErr := vpcService.CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptionsModel) 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.CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptionsModel) + result, response, operationErr = vpcService.CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -31686,16 +32001,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptions *CreateInstanceGroupManagerPolicyOptions)`, func() { + Describe(`CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptions *CreateInstanceGroupManagerActionOptions)`, func() { version := "testString" - createInstanceGroupManagerPolicyPath := "/instance_groups/testString/managers/testString/policies" + createInstanceGroupManagerActionPath := "/instance_groups/testString/managers/testString/actions" 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(createInstanceGroupManagerPolicyPath)) + Expect(req.URL.EscapedPath()).To(Equal(createInstanceGroupManagerActionPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -31722,10 +32037,10 @@ 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/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 11, "policy_type": "target"}`) + fmt.Fprintf(res, "%s", `{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}`) })) }) - It(`Invoke CreateInstanceGroupManagerPolicy successfully with retries`, func() { + It(`Invoke CreateInstanceGroupManagerAction successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -31735,30 +32050,33 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype model - instanceGroupManagerPolicyPrototypeModel := new(vpcv1.InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype) - instanceGroupManagerPolicyPrototypeModel.Name = core.StringPtr("my-instance-group-manager-policy") - instanceGroupManagerPolicyPrototypeModel.MetricType = core.StringPtr("cpu") - instanceGroupManagerPolicyPrototypeModel.MetricValue = core.Int64Ptr(int64(38)) - instanceGroupManagerPolicyPrototypeModel.PolicyType = core.StringPtr("target") + // Construct an instance of the InstanceGroupManagerScheduledActionGroupPrototype model + instanceGroupManagerScheduledActionGroupPrototypeModel := new(vpcv1.InstanceGroupManagerScheduledActionGroupPrototype) + instanceGroupManagerScheduledActionGroupPrototypeModel.MembershipCount = core.Int64Ptr(int64(10)) - // Construct an instance of the CreateInstanceGroupManagerPolicyOptions model - createInstanceGroupManagerPolicyOptionsModel := new(vpcv1.CreateInstanceGroupManagerPolicyOptions) - createInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") - createInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - createInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPrototype = instanceGroupManagerPolicyPrototypeModel - createInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup model + instanceGroupManagerActionPrototypeModel := new(vpcv1.InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup) + instanceGroupManagerActionPrototypeModel.Name = core.StringPtr("my-instance-group-manager-action") + instanceGroupManagerActionPrototypeModel.RunAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + instanceGroupManagerActionPrototypeModel.Group = instanceGroupManagerScheduledActionGroupPrototypeModel + + // Construct an instance of the CreateInstanceGroupManagerActionOptions model + createInstanceGroupManagerActionOptionsModel := new(vpcv1.CreateInstanceGroupManagerActionOptions) + createInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") + createInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + createInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPrototype = instanceGroupManagerActionPrototypeModel + createInstanceGroupManagerActionOptionsModel.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.CreateInstanceGroupManagerPolicyWithContext(ctx, createInstanceGroupManagerPolicyOptionsModel) + _, _, operationErr := vpcService.CreateInstanceGroupManagerActionWithContext(ctx, createInstanceGroupManagerActionOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptionsModel) + result, response, operationErr := vpcService.CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -31766,7 +32084,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreateInstanceGroupManagerPolicyWithContext(ctx, createInstanceGroupManagerPolicyOptionsModel) + _, _, operationErr = vpcService.CreateInstanceGroupManagerActionWithContext(ctx, createInstanceGroupManagerActionOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -31780,7 +32098,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createInstanceGroupManagerPolicyPath)) + Expect(req.URL.EscapedPath()).To(Equal(createInstanceGroupManagerActionPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -31804,10 +32122,10 @@ 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/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 11, "policy_type": "target"}`) + fmt.Fprintf(res, "%s", `{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}`) })) }) - It(`Invoke CreateInstanceGroupManagerPolicy successfully`, func() { + It(`Invoke CreateInstanceGroupManagerAction successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -31817,33 +32135,36 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreateInstanceGroupManagerPolicy(nil) + result, response, operationErr := vpcService.CreateInstanceGroupManagerAction(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype model - instanceGroupManagerPolicyPrototypeModel := new(vpcv1.InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype) - instanceGroupManagerPolicyPrototypeModel.Name = core.StringPtr("my-instance-group-manager-policy") - instanceGroupManagerPolicyPrototypeModel.MetricType = core.StringPtr("cpu") - instanceGroupManagerPolicyPrototypeModel.MetricValue = core.Int64Ptr(int64(38)) - instanceGroupManagerPolicyPrototypeModel.PolicyType = core.StringPtr("target") + // Construct an instance of the InstanceGroupManagerScheduledActionGroupPrototype model + instanceGroupManagerScheduledActionGroupPrototypeModel := new(vpcv1.InstanceGroupManagerScheduledActionGroupPrototype) + instanceGroupManagerScheduledActionGroupPrototypeModel.MembershipCount = core.Int64Ptr(int64(10)) - // Construct an instance of the CreateInstanceGroupManagerPolicyOptions model - createInstanceGroupManagerPolicyOptionsModel := new(vpcv1.CreateInstanceGroupManagerPolicyOptions) - createInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") - createInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - createInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPrototype = instanceGroupManagerPolicyPrototypeModel - createInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup model + instanceGroupManagerActionPrototypeModel := new(vpcv1.InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup) + instanceGroupManagerActionPrototypeModel.Name = core.StringPtr("my-instance-group-manager-action") + instanceGroupManagerActionPrototypeModel.RunAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + instanceGroupManagerActionPrototypeModel.Group = instanceGroupManagerScheduledActionGroupPrototypeModel + + // Construct an instance of the CreateInstanceGroupManagerActionOptions model + createInstanceGroupManagerActionOptionsModel := new(vpcv1.CreateInstanceGroupManagerActionOptions) + createInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") + createInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + createInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPrototype = instanceGroupManagerActionPrototypeModel + createInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptionsModel) + result, response, operationErr = vpcService.CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateInstanceGroupManagerPolicy with error: Operation validation and request error`, func() { + It(`Invoke CreateInstanceGroupManagerAction with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -31852,31 +32173,34 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype model - instanceGroupManagerPolicyPrototypeModel := new(vpcv1.InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype) - instanceGroupManagerPolicyPrototypeModel.Name = core.StringPtr("my-instance-group-manager-policy") - instanceGroupManagerPolicyPrototypeModel.MetricType = core.StringPtr("cpu") - instanceGroupManagerPolicyPrototypeModel.MetricValue = core.Int64Ptr(int64(38)) - instanceGroupManagerPolicyPrototypeModel.PolicyType = core.StringPtr("target") + // Construct an instance of the InstanceGroupManagerScheduledActionGroupPrototype model + instanceGroupManagerScheduledActionGroupPrototypeModel := new(vpcv1.InstanceGroupManagerScheduledActionGroupPrototype) + instanceGroupManagerScheduledActionGroupPrototypeModel.MembershipCount = core.Int64Ptr(int64(10)) - // Construct an instance of the CreateInstanceGroupManagerPolicyOptions model - createInstanceGroupManagerPolicyOptionsModel := new(vpcv1.CreateInstanceGroupManagerPolicyOptions) - createInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") - createInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - createInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPrototype = instanceGroupManagerPolicyPrototypeModel - createInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup model + instanceGroupManagerActionPrototypeModel := new(vpcv1.InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup) + instanceGroupManagerActionPrototypeModel.Name = core.StringPtr("my-instance-group-manager-action") + instanceGroupManagerActionPrototypeModel.RunAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + instanceGroupManagerActionPrototypeModel.Group = instanceGroupManagerScheduledActionGroupPrototypeModel + + // Construct an instance of the CreateInstanceGroupManagerActionOptions model + createInstanceGroupManagerActionOptionsModel := new(vpcv1.CreateInstanceGroupManagerActionOptions) + createInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") + createInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + createInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPrototype = instanceGroupManagerActionPrototypeModel + createInstanceGroupManagerActionOptionsModel.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.CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptionsModel) + result, response, operationErr := vpcService.CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptionsModel) 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 CreateInstanceGroupManagerPolicyOptions model with no property values - createInstanceGroupManagerPolicyOptionsModelNew := new(vpcv1.CreateInstanceGroupManagerPolicyOptions) + // Construct a second instance of the CreateInstanceGroupManagerActionOptions model with no property values + createInstanceGroupManagerActionOptionsModelNew := new(vpcv1.CreateInstanceGroupManagerActionOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptionsModelNew) + result, response, operationErr = vpcService.CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -31894,7 +32218,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(201) })) }) - It(`Invoke CreateInstanceGroupManagerPolicy successfully`, func() { + It(`Invoke CreateInstanceGroupManagerAction successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -31903,22 +32227,25 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype model - instanceGroupManagerPolicyPrototypeModel := new(vpcv1.InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype) - instanceGroupManagerPolicyPrototypeModel.Name = core.StringPtr("my-instance-group-manager-policy") - instanceGroupManagerPolicyPrototypeModel.MetricType = core.StringPtr("cpu") - instanceGroupManagerPolicyPrototypeModel.MetricValue = core.Int64Ptr(int64(38)) - instanceGroupManagerPolicyPrototypeModel.PolicyType = core.StringPtr("target") + // Construct an instance of the InstanceGroupManagerScheduledActionGroupPrototype model + instanceGroupManagerScheduledActionGroupPrototypeModel := new(vpcv1.InstanceGroupManagerScheduledActionGroupPrototype) + instanceGroupManagerScheduledActionGroupPrototypeModel.MembershipCount = core.Int64Ptr(int64(10)) - // Construct an instance of the CreateInstanceGroupManagerPolicyOptions model - createInstanceGroupManagerPolicyOptionsModel := new(vpcv1.CreateInstanceGroupManagerPolicyOptions) - createInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") - createInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - createInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPrototype = instanceGroupManagerPolicyPrototypeModel - createInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup model + instanceGroupManagerActionPrototypeModel := new(vpcv1.InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup) + instanceGroupManagerActionPrototypeModel.Name = core.StringPtr("my-instance-group-manager-action") + instanceGroupManagerActionPrototypeModel.RunAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + instanceGroupManagerActionPrototypeModel.Group = instanceGroupManagerScheduledActionGroupPrototypeModel + + // Construct an instance of the CreateInstanceGroupManagerActionOptions model + createInstanceGroupManagerActionOptionsModel := new(vpcv1.CreateInstanceGroupManagerActionOptions) + createInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") + createInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + createInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPrototype = instanceGroupManagerActionPrototypeModel + createInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptionsModel) + result, response, operationErr := vpcService.CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -31930,16 +32257,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteInstanceGroupManagerPolicy(deleteInstanceGroupManagerPolicyOptions *DeleteInstanceGroupManagerPolicyOptions)`, func() { + Describe(`DeleteInstanceGroupManagerAction(deleteInstanceGroupManagerActionOptions *DeleteInstanceGroupManagerActionOptions)`, func() { version := "testString" - deleteInstanceGroupManagerPolicyPath := "/instance_groups/testString/managers/testString/policies/testString" + deleteInstanceGroupManagerActionPath := "/instance_groups/testString/managers/testString/actions/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(deleteInstanceGroupManagerPolicyPath)) + Expect(req.URL.EscapedPath()).To(Equal(deleteInstanceGroupManagerActionPath)) Expect(req.Method).To(Equal("DELETE")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -31947,7 +32274,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(204) })) }) - It(`Invoke DeleteInstanceGroupManagerPolicy successfully`, func() { + It(`Invoke DeleteInstanceGroupManagerAction successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -31957,23 +32284,23 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.DeleteInstanceGroupManagerPolicy(nil) + response, operationErr := vpcService.DeleteInstanceGroupManagerAction(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) - // Construct an instance of the DeleteInstanceGroupManagerPolicyOptions model - deleteInstanceGroupManagerPolicyOptionsModel := new(vpcv1.DeleteInstanceGroupManagerPolicyOptions) - deleteInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") - deleteInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - deleteInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") - deleteInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteInstanceGroupManagerActionOptions model + deleteInstanceGroupManagerActionOptionsModel := new(vpcv1.DeleteInstanceGroupManagerActionOptions) + deleteInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") + deleteInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + deleteInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") + deleteInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteInstanceGroupManagerPolicy(deleteInstanceGroupManagerPolicyOptionsModel) + response, operationErr = vpcService.DeleteInstanceGroupManagerAction(deleteInstanceGroupManagerActionOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) }) - It(`Invoke DeleteInstanceGroupManagerPolicy with error: Operation validation and request error`, func() { + It(`Invoke DeleteInstanceGroupManagerAction with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -31982,23 +32309,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteInstanceGroupManagerPolicyOptions model - deleteInstanceGroupManagerPolicyOptionsModel := new(vpcv1.DeleteInstanceGroupManagerPolicyOptions) - deleteInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") - deleteInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - deleteInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") - deleteInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteInstanceGroupManagerActionOptions model + deleteInstanceGroupManagerActionOptionsModel := new(vpcv1.DeleteInstanceGroupManagerActionOptions) + deleteInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") + deleteInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + deleteInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") + deleteInstanceGroupManagerActionOptionsModel.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.DeleteInstanceGroupManagerPolicy(deleteInstanceGroupManagerPolicyOptionsModel) + response, operationErr := vpcService.DeleteInstanceGroupManagerAction(deleteInstanceGroupManagerActionOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - // Construct a second instance of the DeleteInstanceGroupManagerPolicyOptions model with no property values - deleteInstanceGroupManagerPolicyOptionsModelNew := new(vpcv1.DeleteInstanceGroupManagerPolicyOptions) + // Construct a second instance of the DeleteInstanceGroupManagerActionOptions model with no property values + deleteInstanceGroupManagerActionOptionsModelNew := new(vpcv1.DeleteInstanceGroupManagerActionOptions) // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteInstanceGroupManagerPolicy(deleteInstanceGroupManagerPolicyOptionsModelNew) + response, operationErr = vpcService.DeleteInstanceGroupManagerAction(deleteInstanceGroupManagerActionOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) }) @@ -32007,16 +32334,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptions *GetInstanceGroupManagerPolicyOptions) - Operation response error`, func() { + Describe(`GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptions *GetInstanceGroupManagerActionOptions) - Operation response error`, func() { version := "testString" - getInstanceGroupManagerPolicyPath := "/instance_groups/testString/managers/testString/policies/testString" + getInstanceGroupManagerActionPath := "/instance_groups/testString/managers/testString/actions/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(getInstanceGroupManagerPolicyPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupManagerActionPath)) 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))})) @@ -32025,7 +32352,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetInstanceGroupManagerPolicy with error: Operation response processing error`, func() { + It(`Invoke GetInstanceGroupManagerAction with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -32034,21 +32361,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceGroupManagerPolicyOptions model - getInstanceGroupManagerPolicyOptionsModel := new(vpcv1.GetInstanceGroupManagerPolicyOptions) - getInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") - getInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - getInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupManagerActionOptions model + getInstanceGroupManagerActionOptionsModel := new(vpcv1.GetInstanceGroupManagerActionOptions) + getInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") + getInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + getInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupManagerActionOptionsModel.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.GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptionsModel) + result, response, operationErr := vpcService.GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptionsModel) 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.GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptionsModel) + result, response, operationErr = vpcService.GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -32058,16 +32385,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptions *GetInstanceGroupManagerPolicyOptions)`, func() { + Describe(`GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptions *GetInstanceGroupManagerActionOptions)`, func() { version := "testString" - getInstanceGroupManagerPolicyPath := "/instance_groups/testString/managers/testString/policies/testString" + getInstanceGroupManagerActionPath := "/instance_groups/testString/managers/testString/actions/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(getInstanceGroupManagerPolicyPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupManagerActionPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -32078,10 +32405,10 @@ 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/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 11, "policy_type": "target"}`) + fmt.Fprintf(res, "%s", `{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}`) })) }) - It(`Invoke GetInstanceGroupManagerPolicy successfully with retries`, func() { + It(`Invoke GetInstanceGroupManagerAction successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -32091,23 +32418,23 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetInstanceGroupManagerPolicyOptions model - getInstanceGroupManagerPolicyOptionsModel := new(vpcv1.GetInstanceGroupManagerPolicyOptions) - getInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") - getInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - getInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupManagerActionOptions model + getInstanceGroupManagerActionOptionsModel := new(vpcv1.GetInstanceGroupManagerActionOptions) + getInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") + getInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + getInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupManagerActionOptionsModel.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.GetInstanceGroupManagerPolicyWithContext(ctx, getInstanceGroupManagerPolicyOptionsModel) + _, _, operationErr := vpcService.GetInstanceGroupManagerActionWithContext(ctx, getInstanceGroupManagerActionOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptionsModel) + result, response, operationErr := vpcService.GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -32115,7 +32442,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetInstanceGroupManagerPolicyWithContext(ctx, getInstanceGroupManagerPolicyOptionsModel) + _, _, operationErr = vpcService.GetInstanceGroupManagerActionWithContext(ctx, getInstanceGroupManagerActionOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -32129,7 +32456,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupManagerPolicyPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupManagerActionPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -32137,10 +32464,10 @@ 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/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 11, "policy_type": "target"}`) + fmt.Fprintf(res, "%s", `{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}`) })) }) - It(`Invoke GetInstanceGroupManagerPolicy successfully`, func() { + It(`Invoke GetInstanceGroupManagerAction successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -32150,26 +32477,26 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetInstanceGroupManagerPolicy(nil) + result, response, operationErr := vpcService.GetInstanceGroupManagerAction(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetInstanceGroupManagerPolicyOptions model - getInstanceGroupManagerPolicyOptionsModel := new(vpcv1.GetInstanceGroupManagerPolicyOptions) - getInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") - getInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - getInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupManagerActionOptions model + getInstanceGroupManagerActionOptionsModel := new(vpcv1.GetInstanceGroupManagerActionOptions) + getInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") + getInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + getInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptionsModel) + result, response, operationErr = vpcService.GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetInstanceGroupManagerPolicy with error: Operation validation and request error`, func() { + It(`Invoke GetInstanceGroupManagerAction with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -32178,24 +32505,24 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceGroupManagerPolicyOptions model - getInstanceGroupManagerPolicyOptionsModel := new(vpcv1.GetInstanceGroupManagerPolicyOptions) - getInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") - getInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - getInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupManagerActionOptions model + getInstanceGroupManagerActionOptionsModel := new(vpcv1.GetInstanceGroupManagerActionOptions) + getInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") + getInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + getInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupManagerActionOptionsModel.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.GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptionsModel) + result, response, operationErr := vpcService.GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptionsModel) 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 GetInstanceGroupManagerPolicyOptions model with no property values - getInstanceGroupManagerPolicyOptionsModelNew := new(vpcv1.GetInstanceGroupManagerPolicyOptions) + // Construct a second instance of the GetInstanceGroupManagerActionOptions model with no property values + getInstanceGroupManagerActionOptionsModelNew := new(vpcv1.GetInstanceGroupManagerActionOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptionsModelNew) + result, response, operationErr = vpcService.GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -32213,7 +32540,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetInstanceGroupManagerPolicy successfully`, func() { + It(`Invoke GetInstanceGroupManagerAction successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -32222,15 +32549,15 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceGroupManagerPolicyOptions model - getInstanceGroupManagerPolicyOptionsModel := new(vpcv1.GetInstanceGroupManagerPolicyOptions) - getInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") - getInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - getInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupManagerActionOptions model + getInstanceGroupManagerActionOptionsModel := new(vpcv1.GetInstanceGroupManagerActionOptions) + getInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") + getInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + getInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptionsModel) + result, response, operationErr := vpcService.GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -32242,16 +32569,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptions *UpdateInstanceGroupManagerPolicyOptions) - Operation response error`, func() { + Describe(`UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptions *UpdateInstanceGroupManagerActionOptions) - Operation response error`, func() { version := "testString" - updateInstanceGroupManagerPolicyPath := "/instance_groups/testString/managers/testString/policies/testString" + updateInstanceGroupManagerActionPath := "/instance_groups/testString/managers/testString/actions/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(updateInstanceGroupManagerPolicyPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupManagerActionPath)) 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))})) @@ -32260,7 +32587,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateInstanceGroupManagerPolicy with error: Operation response processing error`, func() { + It(`Invoke UpdateInstanceGroupManagerAction with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -32269,30 +32596,41 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceGroupManagerPolicyPatch model - instanceGroupManagerPolicyPatchModel := new(vpcv1.InstanceGroupManagerPolicyPatch) - instanceGroupManagerPolicyPatchModel.MetricType = core.StringPtr("cpu") - instanceGroupManagerPolicyPatchModel.MetricValue = core.Int64Ptr(int64(38)) - instanceGroupManagerPolicyPatchModel.Name = core.StringPtr("my-instance-group-manager-policy") - instanceGroupManagerPolicyPatchModelAsPatch, asPatchErr := instanceGroupManagerPolicyPatchModel.AsPatch() + // Construct an instance of the InstanceGroupManagerActionGroupPatch model + instanceGroupManagerActionGroupPatchModel := new(vpcv1.InstanceGroupManagerActionGroupPatch) + instanceGroupManagerActionGroupPatchModel.MembershipCount = core.Int64Ptr(int64(10)) + + // Construct an instance of the InstanceGroupManagerActionManagerPatch model + instanceGroupManagerActionManagerPatchModel := new(vpcv1.InstanceGroupManagerActionManagerPatch) + instanceGroupManagerActionManagerPatchModel.MaxMembershipCount = core.Int64Ptr(int64(10)) + instanceGroupManagerActionManagerPatchModel.MinMembershipCount = core.Int64Ptr(int64(10)) + + // Construct an instance of the InstanceGroupManagerActionPatch model + instanceGroupManagerActionPatchModel := new(vpcv1.InstanceGroupManagerActionPatch) + instanceGroupManagerActionPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") + instanceGroupManagerActionPatchModel.Group = instanceGroupManagerActionGroupPatchModel + instanceGroupManagerActionPatchModel.Manager = instanceGroupManagerActionManagerPatchModel + instanceGroupManagerActionPatchModel.Name = core.StringPtr("my-instance-group-manager-action") + instanceGroupManagerActionPatchModel.RunAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + instanceGroupManagerActionPatchModelAsPatch, asPatchErr := instanceGroupManagerActionPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupManagerPolicyOptions model - updateInstanceGroupManagerPolicyOptionsModel := new(vpcv1.UpdateInstanceGroupManagerPolicyOptions) - updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") - updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - updateInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPatch = instanceGroupManagerPolicyPatchModelAsPatch - updateInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceGroupManagerActionOptions model + updateInstanceGroupManagerActionOptionsModel := new(vpcv1.UpdateInstanceGroupManagerActionOptions) + updateInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") + updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + updateInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPatch = instanceGroupManagerActionPatchModelAsPatch + updateInstanceGroupManagerActionOptionsModel.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.UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptionsModel) 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.UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptionsModel) + result, response, operationErr = vpcService.UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -32302,16 +32640,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptions *UpdateInstanceGroupManagerPolicyOptions)`, func() { + Describe(`UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptions *UpdateInstanceGroupManagerActionOptions)`, func() { version := "testString" - updateInstanceGroupManagerPolicyPath := "/instance_groups/testString/managers/testString/policies/testString" + updateInstanceGroupManagerActionPath := "/instance_groups/testString/managers/testString/actions/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(updateInstanceGroupManagerPolicyPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupManagerActionPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -32338,10 +32676,10 @@ 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/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 11, "policy_type": "target"}`) + fmt.Fprintf(res, "%s", `{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}`) })) }) - It(`Invoke UpdateInstanceGroupManagerPolicy successfully with retries`, func() { + It(`Invoke UpdateInstanceGroupManagerAction successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -32351,32 +32689,43 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the InstanceGroupManagerPolicyPatch model - instanceGroupManagerPolicyPatchModel := new(vpcv1.InstanceGroupManagerPolicyPatch) - instanceGroupManagerPolicyPatchModel.MetricType = core.StringPtr("cpu") - instanceGroupManagerPolicyPatchModel.MetricValue = core.Int64Ptr(int64(38)) - instanceGroupManagerPolicyPatchModel.Name = core.StringPtr("my-instance-group-manager-policy") - instanceGroupManagerPolicyPatchModelAsPatch, asPatchErr := instanceGroupManagerPolicyPatchModel.AsPatch() + // Construct an instance of the InstanceGroupManagerActionGroupPatch model + instanceGroupManagerActionGroupPatchModel := new(vpcv1.InstanceGroupManagerActionGroupPatch) + instanceGroupManagerActionGroupPatchModel.MembershipCount = core.Int64Ptr(int64(10)) + + // Construct an instance of the InstanceGroupManagerActionManagerPatch model + instanceGroupManagerActionManagerPatchModel := new(vpcv1.InstanceGroupManagerActionManagerPatch) + instanceGroupManagerActionManagerPatchModel.MaxMembershipCount = core.Int64Ptr(int64(10)) + instanceGroupManagerActionManagerPatchModel.MinMembershipCount = core.Int64Ptr(int64(10)) + + // Construct an instance of the InstanceGroupManagerActionPatch model + instanceGroupManagerActionPatchModel := new(vpcv1.InstanceGroupManagerActionPatch) + instanceGroupManagerActionPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") + instanceGroupManagerActionPatchModel.Group = instanceGroupManagerActionGroupPatchModel + instanceGroupManagerActionPatchModel.Manager = instanceGroupManagerActionManagerPatchModel + instanceGroupManagerActionPatchModel.Name = core.StringPtr("my-instance-group-manager-action") + instanceGroupManagerActionPatchModel.RunAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + instanceGroupManagerActionPatchModelAsPatch, asPatchErr := instanceGroupManagerActionPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupManagerPolicyOptions model - updateInstanceGroupManagerPolicyOptionsModel := new(vpcv1.UpdateInstanceGroupManagerPolicyOptions) - updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") - updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - updateInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPatch = instanceGroupManagerPolicyPatchModelAsPatch - updateInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceGroupManagerActionOptions model + updateInstanceGroupManagerActionOptionsModel := new(vpcv1.UpdateInstanceGroupManagerActionOptions) + updateInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") + updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + updateInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPatch = instanceGroupManagerActionPatchModelAsPatch + updateInstanceGroupManagerActionOptionsModel.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.UpdateInstanceGroupManagerPolicyWithContext(ctx, updateInstanceGroupManagerPolicyOptionsModel) + _, _, operationErr := vpcService.UpdateInstanceGroupManagerActionWithContext(ctx, updateInstanceGroupManagerActionOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -32384,7 +32733,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateInstanceGroupManagerPolicyWithContext(ctx, updateInstanceGroupManagerPolicyOptionsModel) + _, _, operationErr = vpcService.UpdateInstanceGroupManagerActionWithContext(ctx, updateInstanceGroupManagerActionOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -32398,7 +32747,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupManagerPolicyPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupManagerActionPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -32422,10 +32771,10 @@ 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/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 11, "policy_type": "target"}`) + fmt.Fprintf(res, "%s", `{"auto_delete": true, "auto_delete_timeout": 24, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/actions/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-action", "resource_type": "instance_group_manager_action", "status": "active", "updated_at": "2019-01-01T12:00:00.000Z", "action_type": "scheduled", "cron_spec": "30 */2 * * 1-5", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}`) })) }) - It(`Invoke UpdateInstanceGroupManagerPolicy successfully`, func() { + It(`Invoke UpdateInstanceGroupManagerAction successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -32435,35 +32784,46 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateInstanceGroupManagerPolicy(nil) + result, response, operationErr := vpcService.UpdateInstanceGroupManagerAction(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the InstanceGroupManagerPolicyPatch model - instanceGroupManagerPolicyPatchModel := new(vpcv1.InstanceGroupManagerPolicyPatch) - instanceGroupManagerPolicyPatchModel.MetricType = core.StringPtr("cpu") - instanceGroupManagerPolicyPatchModel.MetricValue = core.Int64Ptr(int64(38)) - instanceGroupManagerPolicyPatchModel.Name = core.StringPtr("my-instance-group-manager-policy") - instanceGroupManagerPolicyPatchModelAsPatch, asPatchErr := instanceGroupManagerPolicyPatchModel.AsPatch() + // Construct an instance of the InstanceGroupManagerActionGroupPatch model + instanceGroupManagerActionGroupPatchModel := new(vpcv1.InstanceGroupManagerActionGroupPatch) + instanceGroupManagerActionGroupPatchModel.MembershipCount = core.Int64Ptr(int64(10)) + + // Construct an instance of the InstanceGroupManagerActionManagerPatch model + instanceGroupManagerActionManagerPatchModel := new(vpcv1.InstanceGroupManagerActionManagerPatch) + instanceGroupManagerActionManagerPatchModel.MaxMembershipCount = core.Int64Ptr(int64(10)) + instanceGroupManagerActionManagerPatchModel.MinMembershipCount = core.Int64Ptr(int64(10)) + + // Construct an instance of the InstanceGroupManagerActionPatch model + instanceGroupManagerActionPatchModel := new(vpcv1.InstanceGroupManagerActionPatch) + instanceGroupManagerActionPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") + instanceGroupManagerActionPatchModel.Group = instanceGroupManagerActionGroupPatchModel + instanceGroupManagerActionPatchModel.Manager = instanceGroupManagerActionManagerPatchModel + instanceGroupManagerActionPatchModel.Name = core.StringPtr("my-instance-group-manager-action") + instanceGroupManagerActionPatchModel.RunAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + instanceGroupManagerActionPatchModelAsPatch, asPatchErr := instanceGroupManagerActionPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupManagerPolicyOptions model - updateInstanceGroupManagerPolicyOptionsModel := new(vpcv1.UpdateInstanceGroupManagerPolicyOptions) - updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") - updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - updateInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPatch = instanceGroupManagerPolicyPatchModelAsPatch - updateInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceGroupManagerActionOptions model + updateInstanceGroupManagerActionOptionsModel := new(vpcv1.UpdateInstanceGroupManagerActionOptions) + updateInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") + updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + updateInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPatch = instanceGroupManagerActionPatchModelAsPatch + updateInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptionsModel) + result, response, operationErr = vpcService.UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateInstanceGroupManagerPolicy with error: Operation validation and request error`, func() { + It(`Invoke UpdateInstanceGroupManagerAction with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -32472,33 +32832,44 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceGroupManagerPolicyPatch model - instanceGroupManagerPolicyPatchModel := new(vpcv1.InstanceGroupManagerPolicyPatch) - instanceGroupManagerPolicyPatchModel.MetricType = core.StringPtr("cpu") - instanceGroupManagerPolicyPatchModel.MetricValue = core.Int64Ptr(int64(38)) - instanceGroupManagerPolicyPatchModel.Name = core.StringPtr("my-instance-group-manager-policy") - instanceGroupManagerPolicyPatchModelAsPatch, asPatchErr := instanceGroupManagerPolicyPatchModel.AsPatch() + // Construct an instance of the InstanceGroupManagerActionGroupPatch model + instanceGroupManagerActionGroupPatchModel := new(vpcv1.InstanceGroupManagerActionGroupPatch) + instanceGroupManagerActionGroupPatchModel.MembershipCount = core.Int64Ptr(int64(10)) + + // Construct an instance of the InstanceGroupManagerActionManagerPatch model + instanceGroupManagerActionManagerPatchModel := new(vpcv1.InstanceGroupManagerActionManagerPatch) + instanceGroupManagerActionManagerPatchModel.MaxMembershipCount = core.Int64Ptr(int64(10)) + instanceGroupManagerActionManagerPatchModel.MinMembershipCount = core.Int64Ptr(int64(10)) + + // Construct an instance of the InstanceGroupManagerActionPatch model + instanceGroupManagerActionPatchModel := new(vpcv1.InstanceGroupManagerActionPatch) + instanceGroupManagerActionPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") + instanceGroupManagerActionPatchModel.Group = instanceGroupManagerActionGroupPatchModel + instanceGroupManagerActionPatchModel.Manager = instanceGroupManagerActionManagerPatchModel + instanceGroupManagerActionPatchModel.Name = core.StringPtr("my-instance-group-manager-action") + instanceGroupManagerActionPatchModel.RunAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + instanceGroupManagerActionPatchModelAsPatch, asPatchErr := instanceGroupManagerActionPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupManagerPolicyOptions model - updateInstanceGroupManagerPolicyOptionsModel := new(vpcv1.UpdateInstanceGroupManagerPolicyOptions) - updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") - updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - updateInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPatch = instanceGroupManagerPolicyPatchModelAsPatch - updateInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceGroupManagerActionOptions model + updateInstanceGroupManagerActionOptionsModel := new(vpcv1.UpdateInstanceGroupManagerActionOptions) + updateInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") + updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + updateInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPatch = instanceGroupManagerActionPatchModelAsPatch + updateInstanceGroupManagerActionOptionsModel.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.UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptionsModel) 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 UpdateInstanceGroupManagerPolicyOptions model with no property values - updateInstanceGroupManagerPolicyOptionsModelNew := new(vpcv1.UpdateInstanceGroupManagerPolicyOptions) + // Construct a second instance of the UpdateInstanceGroupManagerActionOptions model with no property values + updateInstanceGroupManagerActionOptionsModelNew := new(vpcv1.UpdateInstanceGroupManagerActionOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptionsModelNew) + result, response, operationErr = vpcService.UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -32516,7 +32887,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateInstanceGroupManagerPolicy successfully`, func() { + It(`Invoke UpdateInstanceGroupManagerAction successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -32525,24 +32896,35 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceGroupManagerPolicyPatch model - instanceGroupManagerPolicyPatchModel := new(vpcv1.InstanceGroupManagerPolicyPatch) - instanceGroupManagerPolicyPatchModel.MetricType = core.StringPtr("cpu") - instanceGroupManagerPolicyPatchModel.MetricValue = core.Int64Ptr(int64(38)) - instanceGroupManagerPolicyPatchModel.Name = core.StringPtr("my-instance-group-manager-policy") - instanceGroupManagerPolicyPatchModelAsPatch, asPatchErr := instanceGroupManagerPolicyPatchModel.AsPatch() + // Construct an instance of the InstanceGroupManagerActionGroupPatch model + instanceGroupManagerActionGroupPatchModel := new(vpcv1.InstanceGroupManagerActionGroupPatch) + instanceGroupManagerActionGroupPatchModel.MembershipCount = core.Int64Ptr(int64(10)) + + // Construct an instance of the InstanceGroupManagerActionManagerPatch model + instanceGroupManagerActionManagerPatchModel := new(vpcv1.InstanceGroupManagerActionManagerPatch) + instanceGroupManagerActionManagerPatchModel.MaxMembershipCount = core.Int64Ptr(int64(10)) + instanceGroupManagerActionManagerPatchModel.MinMembershipCount = core.Int64Ptr(int64(10)) + + // Construct an instance of the InstanceGroupManagerActionPatch model + instanceGroupManagerActionPatchModel := new(vpcv1.InstanceGroupManagerActionPatch) + instanceGroupManagerActionPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") + instanceGroupManagerActionPatchModel.Group = instanceGroupManagerActionGroupPatchModel + instanceGroupManagerActionPatchModel.Manager = instanceGroupManagerActionManagerPatchModel + instanceGroupManagerActionPatchModel.Name = core.StringPtr("my-instance-group-manager-action") + instanceGroupManagerActionPatchModel.RunAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + instanceGroupManagerActionPatchModelAsPatch, asPatchErr := instanceGroupManagerActionPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupManagerPolicyOptions model - updateInstanceGroupManagerPolicyOptionsModel := new(vpcv1.UpdateInstanceGroupManagerPolicyOptions) - updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") - updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") - updateInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPatch = instanceGroupManagerPolicyPatchModelAsPatch - updateInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceGroupManagerActionOptions model + updateInstanceGroupManagerActionOptionsModel := new(vpcv1.UpdateInstanceGroupManagerActionOptions) + updateInstanceGroupManagerActionOptionsModel.InstanceGroupID = core.StringPtr("testString") + updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + updateInstanceGroupManagerActionOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPatch = instanceGroupManagerActionPatchModelAsPatch + updateInstanceGroupManagerActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -32554,89 +32936,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteInstanceGroupMemberships(deleteInstanceGroupMembershipsOptions *DeleteInstanceGroupMembershipsOptions)`, func() { - version := "testString" - deleteInstanceGroupMembershipsPath := "/instance_groups/testString/memberships" - 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(deleteInstanceGroupMembershipsPath)) - 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(204) - })) - }) - It(`Invoke DeleteInstanceGroupMemberships 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.DeleteInstanceGroupMemberships(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteInstanceGroupMembershipsOptions model - deleteInstanceGroupMembershipsOptionsModel := new(vpcv1.DeleteInstanceGroupMembershipsOptions) - deleteInstanceGroupMembershipsOptionsModel.InstanceGroupID = core.StringPtr("testString") - deleteInstanceGroupMembershipsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteInstanceGroupMemberships(deleteInstanceGroupMembershipsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteInstanceGroupMemberships 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 DeleteInstanceGroupMembershipsOptions model - deleteInstanceGroupMembershipsOptionsModel := new(vpcv1.DeleteInstanceGroupMembershipsOptions) - deleteInstanceGroupMembershipsOptionsModel.InstanceGroupID = core.StringPtr("testString") - deleteInstanceGroupMembershipsOptionsModel.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.DeleteInstanceGroupMemberships(deleteInstanceGroupMembershipsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteInstanceGroupMembershipsOptions model with no property values - deleteInstanceGroupMembershipsOptionsModelNew := new(vpcv1.DeleteInstanceGroupMembershipsOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteInstanceGroupMemberships(deleteInstanceGroupMembershipsOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListInstanceGroupMemberships(listInstanceGroupMembershipsOptions *ListInstanceGroupMembershipsOptions) - Operation response error`, func() { + Describe(`ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptions *ListInstanceGroupManagerPoliciesOptions) - Operation response error`, func() { version := "testString" - listInstanceGroupMembershipsPath := "/instance_groups/testString/memberships" + listInstanceGroupManagerPoliciesPath := "/instance_groups/testString/managers/testString/policies" 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(listInstanceGroupMembershipsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupManagerPoliciesPath)) 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))})) @@ -32647,7 +32956,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListInstanceGroupMemberships with error: Operation response processing error`, func() { + It(`Invoke ListInstanceGroupManagerPolicies with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -32656,21 +32965,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceGroupMembershipsOptions model - listInstanceGroupMembershipsOptionsModel := new(vpcv1.ListInstanceGroupMembershipsOptions) - listInstanceGroupMembershipsOptionsModel.InstanceGroupID = core.StringPtr("testString") - listInstanceGroupMembershipsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupMembershipsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupMembershipsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupManagerPoliciesOptions model + listInstanceGroupManagerPoliciesOptionsModel := new(vpcv1.ListInstanceGroupManagerPoliciesOptions) + listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + listInstanceGroupManagerPoliciesOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupManagerPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupManagerPoliciesOptionsModel.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.ListInstanceGroupMemberships(listInstanceGroupMembershipsOptionsModel) + result, response, operationErr := vpcService.ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptionsModel) 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.ListInstanceGroupMemberships(listInstanceGroupMembershipsOptionsModel) + result, response, operationErr = vpcService.ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -32680,16 +32990,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListInstanceGroupMemberships(listInstanceGroupMembershipsOptions *ListInstanceGroupMembershipsOptions)`, func() { + Describe(`ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptions *ListInstanceGroupManagerPoliciesOptions)`, func() { version := "testString" - listInstanceGroupMembershipsPath := "/instance_groups/testString/memberships" + listInstanceGroupManagerPoliciesPath := "/instance_groups/testString/managers/testString/policies" 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(listInstanceGroupMembershipsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupManagerPoliciesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -32702,10 +33012,10 @@ 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/instance_groups/7241e2a8-601f-11ea-8503-000c29475bed/memberships?limit=20"}, "limit": 20, "memberships": [{"created_at": "2019-01-01T12:00:00.000Z", "delete_instance_on_membership_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/memberships/8b002d86-601f-11ea-898b-000c29475bed", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "name": "my-instance-group-membership", "pool_member": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}, "status": "deleting", "updated_at": "2019-01-01T12:00:00.000Z"}], "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/7241e2a8-601f-11ea-8503-000c29475bed/memberships?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "policies": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 11, "policy_type": "target"}], "total_count": 132}`) })) }) - It(`Invoke ListInstanceGroupMemberships successfully with retries`, func() { + It(`Invoke ListInstanceGroupManagerPolicies successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -32715,23 +33025,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListInstanceGroupMembershipsOptions model - listInstanceGroupMembershipsOptionsModel := new(vpcv1.ListInstanceGroupMembershipsOptions) - listInstanceGroupMembershipsOptionsModel.InstanceGroupID = core.StringPtr("testString") - listInstanceGroupMembershipsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupMembershipsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupMembershipsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - + // Construct an instance of the ListInstanceGroupManagerPoliciesOptions model + listInstanceGroupManagerPoliciesOptionsModel := new(vpcv1.ListInstanceGroupManagerPoliciesOptions) + listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + listInstanceGroupManagerPoliciesOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupManagerPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupManagerPoliciesOptionsModel.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.ListInstanceGroupMembershipsWithContext(ctx, listInstanceGroupMembershipsOptionsModel) + _, _, operationErr := vpcService.ListInstanceGroupManagerPoliciesWithContext(ctx, listInstanceGroupManagerPoliciesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListInstanceGroupMemberships(listInstanceGroupMembershipsOptionsModel) + result, response, operationErr := vpcService.ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -32739,7 +33050,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListInstanceGroupMembershipsWithContext(ctx, listInstanceGroupMembershipsOptionsModel) + _, _, operationErr = vpcService.ListInstanceGroupManagerPoliciesWithContext(ctx, listInstanceGroupManagerPoliciesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -32753,7 +33064,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupMembershipsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupManagerPoliciesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -32763,10 +33074,10 @@ 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/instance_groups/7241e2a8-601f-11ea-8503-000c29475bed/memberships?limit=20"}, "limit": 20, "memberships": [{"created_at": "2019-01-01T12:00:00.000Z", "delete_instance_on_membership_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/memberships/8b002d86-601f-11ea-898b-000c29475bed", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "name": "my-instance-group-membership", "pool_member": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}, "status": "deleting", "updated_at": "2019-01-01T12:00:00.000Z"}], "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/7241e2a8-601f-11ea-8503-000c29475bed/memberships?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "policies": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 11, "policy_type": "target"}], "total_count": 132}`) })) }) - It(`Invoke ListInstanceGroupMemberships successfully`, func() { + It(`Invoke ListInstanceGroupManagerPolicies successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -32776,26 +33087,27 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListInstanceGroupMemberships(nil) + result, response, operationErr := vpcService.ListInstanceGroupManagerPolicies(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListInstanceGroupMembershipsOptions model - listInstanceGroupMembershipsOptionsModel := new(vpcv1.ListInstanceGroupMembershipsOptions) - listInstanceGroupMembershipsOptionsModel.InstanceGroupID = core.StringPtr("testString") - listInstanceGroupMembershipsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupMembershipsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupMembershipsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupManagerPoliciesOptions model + listInstanceGroupManagerPoliciesOptionsModel := new(vpcv1.ListInstanceGroupManagerPoliciesOptions) + listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + listInstanceGroupManagerPoliciesOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupManagerPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupManagerPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListInstanceGroupMemberships(listInstanceGroupMembershipsOptionsModel) + result, response, operationErr = vpcService.ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListInstanceGroupMemberships with error: Operation validation and request error`, func() { + It(`Invoke ListInstanceGroupManagerPolicies with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -32804,24 +33116,25 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceGroupMembershipsOptions model - listInstanceGroupMembershipsOptionsModel := new(vpcv1.ListInstanceGroupMembershipsOptions) - listInstanceGroupMembershipsOptionsModel.InstanceGroupID = core.StringPtr("testString") - listInstanceGroupMembershipsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupMembershipsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupMembershipsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupManagerPoliciesOptions model + listInstanceGroupManagerPoliciesOptionsModel := new(vpcv1.ListInstanceGroupManagerPoliciesOptions) + listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + listInstanceGroupManagerPoliciesOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupManagerPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupManagerPoliciesOptionsModel.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.ListInstanceGroupMemberships(listInstanceGroupMembershipsOptionsModel) + result, response, operationErr := vpcService.ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptionsModel) 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 ListInstanceGroupMembershipsOptions model with no property values - listInstanceGroupMembershipsOptionsModelNew := new(vpcv1.ListInstanceGroupMembershipsOptions) + // Construct a second instance of the ListInstanceGroupManagerPoliciesOptions model with no property values + listInstanceGroupManagerPoliciesOptionsModelNew := new(vpcv1.ListInstanceGroupManagerPoliciesOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListInstanceGroupMemberships(listInstanceGroupMembershipsOptionsModelNew) + result, response, operationErr = vpcService.ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -32839,7 +33152,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListInstanceGroupMemberships successfully`, func() { + It(`Invoke ListInstanceGroupManagerPolicies successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -32848,15 +33161,16 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListInstanceGroupMembershipsOptions model - listInstanceGroupMembershipsOptionsModel := new(vpcv1.ListInstanceGroupMembershipsOptions) - listInstanceGroupMembershipsOptionsModel.InstanceGroupID = core.StringPtr("testString") - listInstanceGroupMembershipsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupMembershipsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstanceGroupMembershipsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupManagerPoliciesOptions model + listInstanceGroupManagerPoliciesOptionsModel := new(vpcv1.ListInstanceGroupManagerPoliciesOptions) + listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + listInstanceGroupManagerPoliciesOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupManagerPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupManagerPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListInstanceGroupMemberships(listInstanceGroupMembershipsOptionsModel) + result, response, operationErr := vpcService.ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -32869,8 +33183,8 @@ var _ = Describe(`VpcV1`, func() { }) Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.InstanceGroupMembershipCollection) - nextObject := new(vpcv1.InstanceGroupMembershipCollectionNext) + responseObject := new(vpcv1.InstanceGroupManagerPolicyCollection) + nextObject := new(vpcv1.InstanceGroupManagerPolicyCollectionNext) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -32879,15 +33193,15 @@ var _ = Describe(`VpcV1`, func() { Expect(value).To(Equal(core.StringPtr("abc-123"))) }) It(`Invoke GetNextStart without a "Next" property in the response`, func() { - responseObject := new(vpcv1.InstanceGroupMembershipCollection) + responseObject := new(vpcv1.InstanceGroupManagerPolicyCollection) 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.InstanceGroupMembershipCollection) - nextObject := new(vpcv1.InstanceGroupMembershipCollectionNext) + responseObject := new(vpcv1.InstanceGroupManagerPolicyCollection) + nextObject := new(vpcv1.InstanceGroupManagerPolicyCollectionNext) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -32903,7 +33217,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupMembershipsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupManagerPoliciesPath)) Expect(req.Method).To(Equal("GET")) // Set mock response @@ -32911,15 +33225,15 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) requestNumber++ if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"memberships":[{"created_at":"2019-01-01T12:00:00.000Z","delete_instance_on_membership_delete":true,"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/memberships/8b002d86-601f-11ea-898b-000c29475bed","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","instance":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance"},"instance_template":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"a6b1a881-2ce8-41a3-80fc-36316a73f803","name":"my-instance-template"},"name":"my-instance-group-membership","pool_member":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004","id":"70294e14-4e61-11e8-bcf4-0242ac110004"},"status":"deleting","updated_at":"2019-01-01T12:00:00.000Z"}]}`) + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"policies":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance-group-manager-policy","updated_at":"2019-01-01T12:00:00.000Z","metric_type":"cpu","metric_value":11,"policy_type":"target"}]}`) } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"memberships":[{"created_at":"2019-01-01T12:00:00.000Z","delete_instance_on_membership_delete":true,"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/memberships/8b002d86-601f-11ea-898b-000c29475bed","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","instance":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance"},"instance_template":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"a6b1a881-2ce8-41a3-80fc-36316a73f803","name":"my-instance-template"},"name":"my-instance-group-membership","pool_member":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004","id":"70294e14-4e61-11e8-bcf4-0242ac110004"},"status":"deleting","updated_at":"2019-01-01T12:00:00.000Z"}]}`) + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"policies":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance-group-manager-policy","updated_at":"2019-01-01T12:00:00.000Z","metric_type":"cpu","metric_value":11,"policy_type":"target"}]}`) } else { res.WriteHeader(400) } })) }) - It(`Use InstanceGroupMembershipsPager.GetNext successfully`, func() { + It(`Use InstanceGroupManagerPoliciesPager.GetNext successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -32928,16 +33242,17 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listInstanceGroupMembershipsOptionsModel := &vpcv1.ListInstanceGroupMembershipsOptions{ - InstanceGroupID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), + listInstanceGroupManagerPoliciesOptionsModel := &vpcv1.ListInstanceGroupManagerPoliciesOptions{ + InstanceGroupID: core.StringPtr("testString"), + InstanceGroupManagerID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), } - pager, err := vpcService.NewInstanceGroupMembershipsPager(listInstanceGroupMembershipsOptionsModel) + pager, err := vpcService.NewInstanceGroupManagerPoliciesPager(listInstanceGroupManagerPoliciesOptionsModel) Expect(err).To(BeNil()) Expect(pager).ToNot(BeNil()) - var allResults []vpcv1.InstanceGroupMembership + var allResults []vpcv1.InstanceGroupManagerPolicyIntf for pager.HasNext() { nextPage, err := pager.GetNext() Expect(err).To(BeNil()) @@ -32946,7 +33261,7 @@ var _ = Describe(`VpcV1`, func() { } Expect(len(allResults)).To(Equal(2)) }) - It(`Use InstanceGroupMembershipsPager.GetAll successfully`, func() { + It(`Use InstanceGroupManagerPoliciesPager.GetAll successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -32955,12 +33270,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listInstanceGroupMembershipsOptionsModel := &vpcv1.ListInstanceGroupMembershipsOptions{ - InstanceGroupID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), + listInstanceGroupManagerPoliciesOptionsModel := &vpcv1.ListInstanceGroupManagerPoliciesOptions{ + InstanceGroupID: core.StringPtr("testString"), + InstanceGroupManagerID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), } - pager, err := vpcService.NewInstanceGroupMembershipsPager(listInstanceGroupMembershipsOptionsModel) + pager, err := vpcService.NewInstanceGroupManagerPoliciesPager(listInstanceGroupManagerPoliciesOptionsModel) Expect(err).To(BeNil()) Expect(pager).ToNot(BeNil()) @@ -32971,100 +33287,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteInstanceGroupMembership(deleteInstanceGroupMembershipOptions *DeleteInstanceGroupMembershipOptions)`, func() { - version := "testString" - deleteInstanceGroupMembershipPath := "/instance_groups/testString/memberships/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(deleteInstanceGroupMembershipPath)) - 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(204) - })) - }) - It(`Invoke DeleteInstanceGroupMembership 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.DeleteInstanceGroupMembership(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteInstanceGroupMembershipOptions model - deleteInstanceGroupMembershipOptionsModel := new(vpcv1.DeleteInstanceGroupMembershipOptions) - deleteInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") - deleteInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") - deleteInstanceGroupMembershipOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteInstanceGroupMembership(deleteInstanceGroupMembershipOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteInstanceGroupMembership 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 DeleteInstanceGroupMembershipOptions model - deleteInstanceGroupMembershipOptionsModel := new(vpcv1.DeleteInstanceGroupMembershipOptions) - deleteInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") - deleteInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") - deleteInstanceGroupMembershipOptionsModel.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.DeleteInstanceGroupMembership(deleteInstanceGroupMembershipOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteInstanceGroupMembershipOptions model with no property values - deleteInstanceGroupMembershipOptionsModelNew := new(vpcv1.DeleteInstanceGroupMembershipOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteInstanceGroupMembership(deleteInstanceGroupMembershipOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetInstanceGroupMembership(getInstanceGroupMembershipOptions *GetInstanceGroupMembershipOptions) - Operation response error`, func() { + Describe(`CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptions *CreateInstanceGroupManagerPolicyOptions) - Operation response error`, func() { version := "testString" - getInstanceGroupMembershipPath := "/instance_groups/testString/memberships/testString" + createInstanceGroupManagerPolicyPath := "/instance_groups/testString/managers/testString/policies" 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(getInstanceGroupMembershipPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createInstanceGroupManagerPolicyPath)) + 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(200) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetInstanceGroupMembership with error: Operation response processing error`, func() { + It(`Invoke CreateInstanceGroupManagerPolicy with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -33073,20 +33314,28 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceGroupMembershipOptions model - getInstanceGroupMembershipOptionsModel := new(vpcv1.GetInstanceGroupMembershipOptions) - getInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") - getInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupMembershipOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype model + instanceGroupManagerPolicyPrototypeModel := new(vpcv1.InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype) + instanceGroupManagerPolicyPrototypeModel.Name = core.StringPtr("my-instance-group-manager-policy") + instanceGroupManagerPolicyPrototypeModel.MetricType = core.StringPtr("cpu") + instanceGroupManagerPolicyPrototypeModel.MetricValue = core.Int64Ptr(int64(38)) + instanceGroupManagerPolicyPrototypeModel.PolicyType = core.StringPtr("target") + + // Construct an instance of the CreateInstanceGroupManagerPolicyOptions model + createInstanceGroupManagerPolicyOptionsModel := new(vpcv1.CreateInstanceGroupManagerPolicyOptions) + createInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") + createInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + createInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPrototype = instanceGroupManagerPolicyPrototypeModel + createInstanceGroupManagerPolicyOptionsModel.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.GetInstanceGroupMembership(getInstanceGroupMembershipOptionsModel) + result, response, operationErr := vpcService.CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptionsModel) 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.GetInstanceGroupMembership(getInstanceGroupMembershipOptionsModel) + result, response, operationErr = vpcService.CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -33096,17 +33345,33 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetInstanceGroupMembership(getInstanceGroupMembershipOptions *GetInstanceGroupMembershipOptions)`, func() { + Describe(`CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptions *CreateInstanceGroupManagerPolicyOptions)`, func() { version := "testString" - getInstanceGroupMembershipPath := "/instance_groups/testString/memberships/testString" + createInstanceGroupManagerPolicyPath := "/instance_groups/testString/managers/testString/policies" 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(getInstanceGroupMembershipPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createInstanceGroupManagerPolicyPath)) + 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))})) @@ -33115,11 +33380,11 @@ 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", "delete_instance_on_membership_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/memberships/8b002d86-601f-11ea-898b-000c29475bed", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "name": "my-instance-group-membership", "pool_member": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}, "status": "deleting", "updated_at": "2019-01-01T12:00:00.000Z"}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 11, "policy_type": "target"}`) })) }) - It(`Invoke GetInstanceGroupMembership successfully with retries`, func() { + It(`Invoke CreateInstanceGroupManagerPolicy successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -33129,22 +33394,30 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetInstanceGroupMembershipOptions model - getInstanceGroupMembershipOptionsModel := new(vpcv1.GetInstanceGroupMembershipOptions) - getInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") - getInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupMembershipOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype model + instanceGroupManagerPolicyPrototypeModel := new(vpcv1.InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype) + instanceGroupManagerPolicyPrototypeModel.Name = core.StringPtr("my-instance-group-manager-policy") + instanceGroupManagerPolicyPrototypeModel.MetricType = core.StringPtr("cpu") + instanceGroupManagerPolicyPrototypeModel.MetricValue = core.Int64Ptr(int64(38)) + instanceGroupManagerPolicyPrototypeModel.PolicyType = core.StringPtr("target") + + // Construct an instance of the CreateInstanceGroupManagerPolicyOptions model + createInstanceGroupManagerPolicyOptionsModel := new(vpcv1.CreateInstanceGroupManagerPolicyOptions) + createInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") + createInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + createInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPrototype = instanceGroupManagerPolicyPrototypeModel + createInstanceGroupManagerPolicyOptionsModel.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.GetInstanceGroupMembershipWithContext(ctx, getInstanceGroupMembershipOptionsModel) + _, _, operationErr := vpcService.CreateInstanceGroupManagerPolicyWithContext(ctx, createInstanceGroupManagerPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetInstanceGroupMembership(getInstanceGroupMembershipOptionsModel) + result, response, operationErr := vpcService.CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -33152,7 +33425,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetInstanceGroupMembershipWithContext(ctx, getInstanceGroupMembershipOptionsModel) + _, _, operationErr = vpcService.CreateInstanceGroupManagerPolicyWithContext(ctx, createInstanceGroupManagerPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -33166,18 +33439,34 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupMembershipPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createInstanceGroupManagerPolicyPath)) + 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(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "delete_instance_on_membership_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/memberships/8b002d86-601f-11ea-898b-000c29475bed", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "name": "my-instance-group-membership", "pool_member": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}, "status": "deleting", "updated_at": "2019-01-01T12:00:00.000Z"}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 11, "policy_type": "target"}`) })) }) - It(`Invoke GetInstanceGroupMembership successfully`, func() { + It(`Invoke CreateInstanceGroupManagerPolicy successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -33187,25 +33476,33 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetInstanceGroupMembership(nil) + result, response, operationErr := vpcService.CreateInstanceGroupManagerPolicy(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetInstanceGroupMembershipOptions model - getInstanceGroupMembershipOptionsModel := new(vpcv1.GetInstanceGroupMembershipOptions) - getInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") - getInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupMembershipOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype model + instanceGroupManagerPolicyPrototypeModel := new(vpcv1.InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype) + instanceGroupManagerPolicyPrototypeModel.Name = core.StringPtr("my-instance-group-manager-policy") + instanceGroupManagerPolicyPrototypeModel.MetricType = core.StringPtr("cpu") + instanceGroupManagerPolicyPrototypeModel.MetricValue = core.Int64Ptr(int64(38)) + instanceGroupManagerPolicyPrototypeModel.PolicyType = core.StringPtr("target") + + // Construct an instance of the CreateInstanceGroupManagerPolicyOptions model + createInstanceGroupManagerPolicyOptionsModel := new(vpcv1.CreateInstanceGroupManagerPolicyOptions) + createInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") + createInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + createInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPrototype = instanceGroupManagerPolicyPrototypeModel + createInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetInstanceGroupMembership(getInstanceGroupMembershipOptionsModel) + result, response, operationErr = vpcService.CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetInstanceGroupMembership with error: Operation validation and request error`, func() { + It(`Invoke CreateInstanceGroupManagerPolicy with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -33214,23 +33511,31 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceGroupMembershipOptions model - getInstanceGroupMembershipOptionsModel := new(vpcv1.GetInstanceGroupMembershipOptions) - getInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") - getInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupMembershipOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype model + instanceGroupManagerPolicyPrototypeModel := new(vpcv1.InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype) + instanceGroupManagerPolicyPrototypeModel.Name = core.StringPtr("my-instance-group-manager-policy") + instanceGroupManagerPolicyPrototypeModel.MetricType = core.StringPtr("cpu") + instanceGroupManagerPolicyPrototypeModel.MetricValue = core.Int64Ptr(int64(38)) + instanceGroupManagerPolicyPrototypeModel.PolicyType = core.StringPtr("target") + + // Construct an instance of the CreateInstanceGroupManagerPolicyOptions model + createInstanceGroupManagerPolicyOptionsModel := new(vpcv1.CreateInstanceGroupManagerPolicyOptions) + createInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") + createInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + createInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPrototype = instanceGroupManagerPolicyPrototypeModel + createInstanceGroupManagerPolicyOptionsModel.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.GetInstanceGroupMembership(getInstanceGroupMembershipOptionsModel) + result, response, operationErr := vpcService.CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptionsModel) 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 GetInstanceGroupMembershipOptions model with no property values - getInstanceGroupMembershipOptionsModelNew := new(vpcv1.GetInstanceGroupMembershipOptions) + // Construct a second instance of the CreateInstanceGroupManagerPolicyOptions model with no property values + createInstanceGroupManagerPolicyOptionsModelNew := new(vpcv1.CreateInstanceGroupManagerPolicyOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetInstanceGroupMembership(getInstanceGroupMembershipOptionsModelNew) + result, response, operationErr = vpcService.CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -33245,10 +33550,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke GetInstanceGroupMembership successfully`, func() { + It(`Invoke CreateInstanceGroupManagerPolicy successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -33257,14 +33562,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetInstanceGroupMembershipOptions model - getInstanceGroupMembershipOptionsModel := new(vpcv1.GetInstanceGroupMembershipOptions) - getInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") - getInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") - getInstanceGroupMembershipOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype model + instanceGroupManagerPolicyPrototypeModel := new(vpcv1.InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype) + instanceGroupManagerPolicyPrototypeModel.Name = core.StringPtr("my-instance-group-manager-policy") + instanceGroupManagerPolicyPrototypeModel.MetricType = core.StringPtr("cpu") + instanceGroupManagerPolicyPrototypeModel.MetricValue = core.Int64Ptr(int64(38)) + instanceGroupManagerPolicyPrototypeModel.PolicyType = core.StringPtr("target") + + // Construct an instance of the CreateInstanceGroupManagerPolicyOptions model + createInstanceGroupManagerPolicyOptionsModel := new(vpcv1.CreateInstanceGroupManagerPolicyOptions) + createInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") + createInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + createInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPrototype = instanceGroupManagerPolicyPrototypeModel + createInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetInstanceGroupMembership(getInstanceGroupMembershipOptionsModel) + result, response, operationErr := vpcService.CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -33276,25 +33589,24 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptions *UpdateInstanceGroupMembershipOptions) - Operation response error`, func() { + Describe(`DeleteInstanceGroupManagerPolicy(deleteInstanceGroupManagerPolicyOptions *DeleteInstanceGroupManagerPolicyOptions)`, func() { version := "testString" - updateInstanceGroupMembershipPath := "/instance_groups/testString/memberships/testString" - Context(`Using mock server endpoint with invalid JSON response`, func() { + deleteInstanceGroupManagerPolicyPath := "/instance_groups/testString/managers/testString/policies/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(updateInstanceGroupMembershipPath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(deleteInstanceGroupManagerPolicyPath)) + 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.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprint(res, `} this is not valid json {`) + res.WriteHeader(204) })) }) - It(`Invoke UpdateInstanceGroupMembership with error: Operation response processing error`, func() { + It(`Invoke DeleteInstanceGroupManagerPolicy successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -33303,76 +33615,76 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceGroupMembershipPatch model - instanceGroupMembershipPatchModel := new(vpcv1.InstanceGroupMembershipPatch) - instanceGroupMembershipPatchModel.Name = core.StringPtr("my-instance-group-membership") - instanceGroupMembershipPatchModelAsPatch, asPatchErr := instanceGroupMembershipPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Invoke operation with nil options model (negative test) + response, operationErr := vpcService.DeleteInstanceGroupManagerPolicy(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupMembershipOptions model - updateInstanceGroupMembershipOptionsModel := new(vpcv1.UpdateInstanceGroupMembershipOptions) - updateInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") - updateInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupMembershipOptionsModel.InstanceGroupMembershipPatch = instanceGroupMembershipPatchModelAsPatch - updateInstanceGroupMembershipOptionsModel.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.UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptionsModel) - Expect(operationErr).ToNot(BeNil()) + // Construct an instance of the DeleteInstanceGroupManagerPolicyOptions model + deleteInstanceGroupManagerPolicyOptionsModel := new(vpcv1.DeleteInstanceGroupManagerPolicyOptions) + deleteInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") + deleteInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + deleteInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") + deleteInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteInstanceGroupManagerPolicy(deleteInstanceGroupManagerPolicyOptionsModel) + Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) + }) + It(`Invoke DeleteInstanceGroupManagerPolicy 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()) - // Enable retries and test again - vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptionsModel) + // Construct an instance of the DeleteInstanceGroupManagerPolicyOptions model + deleteInstanceGroupManagerPolicyOptionsModel := new(vpcv1.DeleteInstanceGroupManagerPolicyOptions) + deleteInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") + deleteInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + deleteInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") + deleteInstanceGroupManagerPolicyOptionsModel.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.DeleteInstanceGroupManagerPolicy(deleteInstanceGroupManagerPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteInstanceGroupManagerPolicyOptions model with no property values + deleteInstanceGroupManagerPolicyOptionsModelNew := new(vpcv1.DeleteInstanceGroupManagerPolicyOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteInstanceGroupManagerPolicy(deleteInstanceGroupManagerPolicyOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptions *UpdateInstanceGroupMembershipOptions)`, func() { + Describe(`GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptions *GetInstanceGroupManagerPolicyOptions) - Operation response error`, func() { version := "testString" - updateInstanceGroupMembershipPath := "/instance_groups/testString/memberships/testString" - Context(`Using mock server endpoint with timeout`, func() { + getInstanceGroupManagerPolicyPath := "/instance_groups/testString/managers/testString/policies/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(updateInstanceGroupMembershipPath)) - 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.EscapedPath()).To(Equal(getInstanceGroupManagerPolicyPath)) + 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", `{"created_at": "2019-01-01T12:00:00.000Z", "delete_instance_on_membership_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/memberships/8b002d86-601f-11ea-898b-000c29475bed", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "name": "my-instance-group-membership", "pool_member": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}, "status": "deleting", "updated_at": "2019-01-01T12:00:00.000Z"}`) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateInstanceGroupMembership successfully with retries`, func() { + It(`Invoke GetInstanceGroupManagerPolicy with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -33380,31 +33692,81 @@ var _ = Describe(`VpcV1`, func() { }) Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - vpcService.EnableRetries(0, 0) - // Construct an instance of the InstanceGroupMembershipPatch model - instanceGroupMembershipPatchModel := new(vpcv1.InstanceGroupMembershipPatch) - instanceGroupMembershipPatchModel.Name = core.StringPtr("my-instance-group-membership") - instanceGroupMembershipPatchModelAsPatch, asPatchErr := instanceGroupMembershipPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the GetInstanceGroupManagerPolicyOptions model + getInstanceGroupManagerPolicyOptionsModel := new(vpcv1.GetInstanceGroupManagerPolicyOptions) + getInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") + getInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + getInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupManagerPolicyOptionsModel.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.GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) - // Construct an instance of the UpdateInstanceGroupMembershipOptions model - updateInstanceGroupMembershipOptionsModel := new(vpcv1.UpdateInstanceGroupMembershipOptions) - updateInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") - updateInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupMembershipOptionsModel.InstanceGroupMembershipPatch = instanceGroupMembershipPatchModelAsPatch - updateInstanceGroupMembershipOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptions *GetInstanceGroupManagerPolicyOptions)`, func() { + version := "testString" + getInstanceGroupManagerPolicyPath := "/instance_groups/testString/managers/testString/policies/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(getInstanceGroupManagerPolicyPath)) + 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", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 11, "policy_type": "target"}`) + })) + }) + It(`Invoke GetInstanceGroupManagerPolicy 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 GetInstanceGroupManagerPolicyOptions model + getInstanceGroupManagerPolicyOptionsModel := new(vpcv1.GetInstanceGroupManagerPolicyOptions) + getInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") + getInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + getInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupManagerPolicyOptionsModel.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.UpdateInstanceGroupMembershipWithContext(ctx, updateInstanceGroupMembershipOptionsModel) + _, _, operationErr := vpcService.GetInstanceGroupManagerPolicyWithContext(ctx, getInstanceGroupManagerPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptionsModel) + result, response, operationErr := vpcService.GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -33412,7 +33774,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateInstanceGroupMembershipWithContext(ctx, updateInstanceGroupMembershipOptionsModel) + _, _, operationErr = vpcService.GetInstanceGroupManagerPolicyWithContext(ctx, getInstanceGroupManagerPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -33426,34 +33788,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupMembershipPath)) - 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.EscapedPath()).To(Equal(getInstanceGroupManagerPolicyPath)) + 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", `{"created_at": "2019-01-01T12:00:00.000Z", "delete_instance_on_membership_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/memberships/8b002d86-601f-11ea-898b-000c29475bed", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "name": "my-instance-group-membership", "pool_member": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}, "status": "deleting", "updated_at": "2019-01-01T12:00:00.000Z"}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 11, "policy_type": "target"}`) })) }) - It(`Invoke UpdateInstanceGroupMembership successfully`, func() { + It(`Invoke GetInstanceGroupManagerPolicy successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -33463,32 +33809,26 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateInstanceGroupMembership(nil) + result, response, operationErr := vpcService.GetInstanceGroupManagerPolicy(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the InstanceGroupMembershipPatch model - instanceGroupMembershipPatchModel := new(vpcv1.InstanceGroupMembershipPatch) - instanceGroupMembershipPatchModel.Name = core.StringPtr("my-instance-group-membership") - instanceGroupMembershipPatchModelAsPatch, asPatchErr := instanceGroupMembershipPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateInstanceGroupMembershipOptions model - updateInstanceGroupMembershipOptionsModel := new(vpcv1.UpdateInstanceGroupMembershipOptions) - updateInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") - updateInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupMembershipOptionsModel.InstanceGroupMembershipPatch = instanceGroupMembershipPatchModelAsPatch - updateInstanceGroupMembershipOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupManagerPolicyOptions model + getInstanceGroupManagerPolicyOptionsModel := new(vpcv1.GetInstanceGroupManagerPolicyOptions) + getInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") + getInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + getInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptionsModel) + result, response, operationErr = vpcService.GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateInstanceGroupMembership with error: Operation validation and request error`, func() { + It(`Invoke GetInstanceGroupManagerPolicy with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -33497,30 +33837,24 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceGroupMembershipPatch model - instanceGroupMembershipPatchModel := new(vpcv1.InstanceGroupMembershipPatch) - instanceGroupMembershipPatchModel.Name = core.StringPtr("my-instance-group-membership") - instanceGroupMembershipPatchModelAsPatch, asPatchErr := instanceGroupMembershipPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateInstanceGroupMembershipOptions model - updateInstanceGroupMembershipOptionsModel := new(vpcv1.UpdateInstanceGroupMembershipOptions) - updateInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") - updateInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupMembershipOptionsModel.InstanceGroupMembershipPatch = instanceGroupMembershipPatchModelAsPatch - updateInstanceGroupMembershipOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupManagerPolicyOptions model + getInstanceGroupManagerPolicyOptionsModel := new(vpcv1.GetInstanceGroupManagerPolicyOptions) + getInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") + getInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + getInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupManagerPolicyOptionsModel.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.UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptionsModel) + result, response, operationErr := vpcService.GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptionsModel) 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 UpdateInstanceGroupMembershipOptions model with no property values - updateInstanceGroupMembershipOptionsModelNew := new(vpcv1.UpdateInstanceGroupMembershipOptions) + // Construct a second instance of the GetInstanceGroupManagerPolicyOptions model with no property values + getInstanceGroupManagerPolicyOptionsModelNew := new(vpcv1.GetInstanceGroupManagerPolicyOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptionsModelNew) + result, response, operationErr = vpcService.GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -33538,7 +33872,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateInstanceGroupMembership successfully`, func() { + It(`Invoke GetInstanceGroupManagerPolicy successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -33547,21 +33881,15 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the InstanceGroupMembershipPatch model - instanceGroupMembershipPatchModel := new(vpcv1.InstanceGroupMembershipPatch) - instanceGroupMembershipPatchModel.Name = core.StringPtr("my-instance-group-membership") - instanceGroupMembershipPatchModelAsPatch, asPatchErr := instanceGroupMembershipPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateInstanceGroupMembershipOptions model - updateInstanceGroupMembershipOptionsModel := new(vpcv1.UpdateInstanceGroupMembershipOptions) - updateInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") - updateInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") - updateInstanceGroupMembershipOptionsModel.InstanceGroupMembershipPatch = instanceGroupMembershipPatchModelAsPatch - updateInstanceGroupMembershipOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupManagerPolicyOptions model + getInstanceGroupManagerPolicyOptionsModel := new(vpcv1.GetInstanceGroupManagerPolicyOptions) + getInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") + getInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + getInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptionsModel) + result, response, operationErr := vpcService.GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -33573,30 +33901,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListDedicatedHostGroups(listDedicatedHostGroupsOptions *ListDedicatedHostGroupsOptions) - Operation response error`, func() { + Describe(`UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptions *UpdateInstanceGroupManagerPolicyOptions) - Operation response error`, func() { version := "testString" - listDedicatedHostGroupsPath := "/dedicated_host/groups" + updateInstanceGroupManagerPolicyPath := "/instance_groups/testString/managers/testString/policies/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(listDedicatedHostGroupsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupManagerPolicyPath)) + 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))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"us-south-1"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListDedicatedHostGroups with error: Operation response processing error`, func() { + It(`Invoke UpdateInstanceGroupManagerPolicy with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -33605,23 +33928,30 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListDedicatedHostGroupsOptions model - listDedicatedHostGroupsOptionsModel := new(vpcv1.ListDedicatedHostGroupsOptions) - listDedicatedHostGroupsOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listDedicatedHostGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listDedicatedHostGroupsOptionsModel.ZoneName = core.StringPtr("us-south-1") - listDedicatedHostGroupsOptionsModel.Name = core.StringPtr("testString") - listDedicatedHostGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the InstanceGroupManagerPolicyPatch model + instanceGroupManagerPolicyPatchModel := new(vpcv1.InstanceGroupManagerPolicyPatch) + instanceGroupManagerPolicyPatchModel.MetricType = core.StringPtr("cpu") + instanceGroupManagerPolicyPatchModel.MetricValue = core.Int64Ptr(int64(38)) + instanceGroupManagerPolicyPatchModel.Name = core.StringPtr("my-instance-group-manager-policy") + instanceGroupManagerPolicyPatchModelAsPatch, asPatchErr := instanceGroupManagerPolicyPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateInstanceGroupManagerPolicyOptions model + updateInstanceGroupManagerPolicyOptionsModel := new(vpcv1.UpdateInstanceGroupManagerPolicyOptions) + updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") + updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + updateInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPatch = instanceGroupManagerPolicyPatchModelAsPatch + updateInstanceGroupManagerPolicyOptionsModel.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.ListDedicatedHostGroups(listDedicatedHostGroupsOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptionsModel) 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.ListDedicatedHostGroups(listDedicatedHostGroupsOptionsModel) + result, response, operationErr = vpcService.UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -33631,35 +33961,46 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListDedicatedHostGroups(listDedicatedHostGroupsOptions *ListDedicatedHostGroupsOptions)`, func() { + Describe(`UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptions *UpdateInstanceGroupManagerPolicyOptions)`, func() { version := "testString" - listDedicatedHostGroupsPath := "/dedicated_host/groups" + updateInstanceGroupManagerPolicyPath := "/instance_groups/testString/managers/testString/policies/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(listDedicatedHostGroupsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupManagerPolicyPath)) + 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))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"us-south-1"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) // 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/dedicated_host/groups?limit=20"}, "groups": [{"class": "mx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 11, "policy_type": "target"}`) })) }) - It(`Invoke ListDedicatedHostGroups successfully with retries`, func() { + It(`Invoke UpdateInstanceGroupManagerPolicy successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -33669,25 +34010,32 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListDedicatedHostGroupsOptions model - listDedicatedHostGroupsOptionsModel := new(vpcv1.ListDedicatedHostGroupsOptions) - listDedicatedHostGroupsOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listDedicatedHostGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listDedicatedHostGroupsOptionsModel.ZoneName = core.StringPtr("us-south-1") - listDedicatedHostGroupsOptionsModel.Name = core.StringPtr("testString") - listDedicatedHostGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the InstanceGroupManagerPolicyPatch model + instanceGroupManagerPolicyPatchModel := new(vpcv1.InstanceGroupManagerPolicyPatch) + instanceGroupManagerPolicyPatchModel.MetricType = core.StringPtr("cpu") + instanceGroupManagerPolicyPatchModel.MetricValue = core.Int64Ptr(int64(38)) + instanceGroupManagerPolicyPatchModel.Name = core.StringPtr("my-instance-group-manager-policy") + instanceGroupManagerPolicyPatchModelAsPatch, asPatchErr := instanceGroupManagerPolicyPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateInstanceGroupManagerPolicyOptions model + updateInstanceGroupManagerPolicyOptionsModel := new(vpcv1.UpdateInstanceGroupManagerPolicyOptions) + updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") + updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + updateInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPatch = instanceGroupManagerPolicyPatchModelAsPatch + updateInstanceGroupManagerPolicyOptionsModel.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.ListDedicatedHostGroupsWithContext(ctx, listDedicatedHostGroupsOptionsModel) + _, _, operationErr := vpcService.UpdateInstanceGroupManagerPolicyWithContext(ctx, updateInstanceGroupManagerPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListDedicatedHostGroups(listDedicatedHostGroupsOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -33695,7 +34043,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListDedicatedHostGroupsWithContext(ctx, listDedicatedHostGroupsOptionsModel) + _, _, operationErr = vpcService.UpdateInstanceGroupManagerPolicyWithContext(ctx, updateInstanceGroupManagerPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -33709,23 +34057,34 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostGroupsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupManagerPolicyPath)) + 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))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"us-south-1"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) // 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/dedicated_host/groups?limit=20"}, "groups": [{"class": "mx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/managers/4c939b00-601f-11ea-bca2-000c29475bed/policies/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance-group-manager-policy", "updated_at": "2019-01-01T12:00:00.000Z", "metric_type": "cpu", "metric_value": 11, "policy_type": "target"}`) })) }) - It(`Invoke ListDedicatedHostGroups successfully`, func() { + It(`Invoke UpdateInstanceGroupManagerPolicy successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -33735,28 +34094,35 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListDedicatedHostGroups(nil) + result, response, operationErr := vpcService.UpdateInstanceGroupManagerPolicy(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListDedicatedHostGroupsOptions model - listDedicatedHostGroupsOptionsModel := new(vpcv1.ListDedicatedHostGroupsOptions) - listDedicatedHostGroupsOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listDedicatedHostGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listDedicatedHostGroupsOptionsModel.ZoneName = core.StringPtr("us-south-1") - listDedicatedHostGroupsOptionsModel.Name = core.StringPtr("testString") - listDedicatedHostGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the InstanceGroupManagerPolicyPatch model + instanceGroupManagerPolicyPatchModel := new(vpcv1.InstanceGroupManagerPolicyPatch) + instanceGroupManagerPolicyPatchModel.MetricType = core.StringPtr("cpu") + instanceGroupManagerPolicyPatchModel.MetricValue = core.Int64Ptr(int64(38)) + instanceGroupManagerPolicyPatchModel.Name = core.StringPtr("my-instance-group-manager-policy") + instanceGroupManagerPolicyPatchModelAsPatch, asPatchErr := instanceGroupManagerPolicyPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateInstanceGroupManagerPolicyOptions model + updateInstanceGroupManagerPolicyOptionsModel := new(vpcv1.UpdateInstanceGroupManagerPolicyOptions) + updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") + updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + updateInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPatch = instanceGroupManagerPolicyPatchModelAsPatch + updateInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListDedicatedHostGroups(listDedicatedHostGroupsOptionsModel) + result, response, operationErr = vpcService.UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListDedicatedHostGroups with error: Operation request error`, func() { + It(`Invoke UpdateInstanceGroupManagerPolicy with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -33765,22 +34131,36 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListDedicatedHostGroupsOptions model - listDedicatedHostGroupsOptionsModel := new(vpcv1.ListDedicatedHostGroupsOptions) - listDedicatedHostGroupsOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listDedicatedHostGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listDedicatedHostGroupsOptionsModel.ZoneName = core.StringPtr("us-south-1") - listDedicatedHostGroupsOptionsModel.Name = core.StringPtr("testString") - listDedicatedHostGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the InstanceGroupManagerPolicyPatch model + instanceGroupManagerPolicyPatchModel := new(vpcv1.InstanceGroupManagerPolicyPatch) + instanceGroupManagerPolicyPatchModel.MetricType = core.StringPtr("cpu") + instanceGroupManagerPolicyPatchModel.MetricValue = core.Int64Ptr(int64(38)) + instanceGroupManagerPolicyPatchModel.Name = core.StringPtr("my-instance-group-manager-policy") + instanceGroupManagerPolicyPatchModelAsPatch, asPatchErr := instanceGroupManagerPolicyPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateInstanceGroupManagerPolicyOptions model + updateInstanceGroupManagerPolicyOptionsModel := new(vpcv1.UpdateInstanceGroupManagerPolicyOptions) + updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") + updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + updateInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPatch = instanceGroupManagerPolicyPatchModelAsPatch + updateInstanceGroupManagerPolicyOptionsModel.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.ListDedicatedHostGroups(listDedicatedHostGroupsOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptionsModel) 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 UpdateInstanceGroupManagerPolicyOptions model with no property values + updateInstanceGroupManagerPolicyOptionsModelNew := new(vpcv1.UpdateInstanceGroupManagerPolicyOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -33795,7 +34175,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListDedicatedHostGroups successfully`, func() { + It(`Invoke UpdateInstanceGroupManagerPolicy successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -33804,17 +34184,24 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListDedicatedHostGroupsOptions model - listDedicatedHostGroupsOptionsModel := new(vpcv1.ListDedicatedHostGroupsOptions) - listDedicatedHostGroupsOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listDedicatedHostGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listDedicatedHostGroupsOptionsModel.ZoneName = core.StringPtr("us-south-1") - listDedicatedHostGroupsOptionsModel.Name = core.StringPtr("testString") - listDedicatedHostGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the InstanceGroupManagerPolicyPatch model + instanceGroupManagerPolicyPatchModel := new(vpcv1.InstanceGroupManagerPolicyPatch) + instanceGroupManagerPolicyPatchModel.MetricType = core.StringPtr("cpu") + instanceGroupManagerPolicyPatchModel.MetricValue = core.Int64Ptr(int64(38)) + instanceGroupManagerPolicyPatchModel.Name = core.StringPtr("my-instance-group-manager-policy") + instanceGroupManagerPolicyPatchModelAsPatch, asPatchErr := instanceGroupManagerPolicyPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateInstanceGroupManagerPolicyOptions model + updateInstanceGroupManagerPolicyOptionsModel := new(vpcv1.UpdateInstanceGroupManagerPolicyOptions) + updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupID = core.StringPtr("testString") + updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") + updateInstanceGroupManagerPolicyOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPatch = instanceGroupManagerPolicyPatchModelAsPatch + updateInstanceGroupManagerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListDedicatedHostGroups(listDedicatedHostGroupsOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -33825,59 +34212,25 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) - Context(`Test pagination helper method on response`, func() { - It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.DedicatedHostGroupCollection) - nextObject := new(vpcv1.DedicatedHostGroupCollectionNext) - 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.DedicatedHostGroupCollection) - - 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.DedicatedHostGroupCollection) - nextObject := new(vpcv1.DedicatedHostGroupCollectionNext) - nextObject.Href = core.StringPtr("ibm.com") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - }) - Context(`Using mock server endpoint - paginated response`, func() { + }) + Describe(`DeleteInstanceGroupMemberships(deleteInstanceGroupMembershipsOptions *DeleteInstanceGroupMembershipsOptions)`, func() { + version := "testString" + deleteInstanceGroupMembershipsPath := "/instance_groups/testString/memberships" + Context(`Using mock server endpoint`, func() { BeforeEach(func() { - var requestNumber int = 0 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(listDedicatedHostGroupsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deleteInstanceGroupMembershipsPath)) + Expect(req.Method).To(Equal("DELETE")) - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - requestNumber++ - if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"groups":[{"class":"mx2","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","dedicated_hosts":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-host","resource_type":"dedicated_host"}],"family":"balanced","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-host-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"dedicated_host_group","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16"}],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}]}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"groups":[{"class":"mx2","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","dedicated_hosts":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-host","resource_type":"dedicated_host"}],"family":"balanced","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-host-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"dedicated_host_group","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16"}],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}]}`) - } else { - res.WriteHeader(400) - } + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) })) }) - It(`Use DedicatedHostGroupsPager.GetNext successfully`, func() { + It(`Invoke DeleteInstanceGroupMemberships successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -33886,27 +34239,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listDedicatedHostGroupsOptionsModel := &vpcv1.ListDedicatedHostGroupsOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - ZoneName: core.StringPtr("us-south-1"), - Name: core.StringPtr("testString"), - } + // Invoke operation with nil options model (negative test) + response, operationErr := vpcService.DeleteInstanceGroupMemberships(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) - pager, err := vpcService.NewDedicatedHostGroupsPager(listDedicatedHostGroupsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) + // Construct an instance of the DeleteInstanceGroupMembershipsOptions model + deleteInstanceGroupMembershipsOptionsModel := new(vpcv1.DeleteInstanceGroupMembershipsOptions) + deleteInstanceGroupMembershipsOptionsModel.InstanceGroupID = core.StringPtr("testString") + deleteInstanceGroupMembershipsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - var allResults []vpcv1.DedicatedHostGroup - for pager.HasNext() { - nextPage, err := pager.GetNext() - Expect(err).To(BeNil()) - Expect(nextPage).ToNot(BeNil()) - allResults = append(allResults, nextPage...) - } - Expect(len(allResults)).To(Equal(2)) + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteInstanceGroupMemberships(deleteInstanceGroupMembershipsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) }) - It(`Use DedicatedHostGroupsPager.GetAll successfully`, func() { + It(`Invoke DeleteInstanceGroupMemberships with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -33915,43 +34263,50 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listDedicatedHostGroupsOptionsModel := &vpcv1.ListDedicatedHostGroupsOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - ZoneName: core.StringPtr("us-south-1"), - Name: core.StringPtr("testString"), - } - - pager, err := vpcService.NewDedicatedHostGroupsPager(listDedicatedHostGroupsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - allResults, err := pager.GetAll() + // Construct an instance of the DeleteInstanceGroupMembershipsOptions model + deleteInstanceGroupMembershipsOptionsModel := new(vpcv1.DeleteInstanceGroupMembershipsOptions) + deleteInstanceGroupMembershipsOptionsModel.InstanceGroupID = core.StringPtr("testString") + deleteInstanceGroupMembershipsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - Expect(allResults).ToNot(BeNil()) - Expect(len(allResults)).To(Equal(2)) + response, operationErr := vpcService.DeleteInstanceGroupMemberships(deleteInstanceGroupMembershipsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteInstanceGroupMembershipsOptions model with no property values + deleteInstanceGroupMembershipsOptionsModelNew := new(vpcv1.DeleteInstanceGroupMembershipsOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteInstanceGroupMemberships(deleteInstanceGroupMembershipsOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() }) }) }) - Describe(`CreateDedicatedHostGroup(createDedicatedHostGroupOptions *CreateDedicatedHostGroupOptions) - Operation response error`, func() { + Describe(`ListInstanceGroupMemberships(listInstanceGroupMembershipsOptions *ListInstanceGroupMembershipsOptions) - Operation response error`, func() { version := "testString" - createDedicatedHostGroupPath := "/dedicated_host/groups" + listInstanceGroupMembershipsPath := "/instance_groups/testString/memberships" 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(createDedicatedHostGroupPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupMembershipsPath)) + 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(10))})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateDedicatedHostGroup with error: Operation response processing error`, func() { + It(`Invoke ListInstanceGroupMemberships with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -33960,31 +34315,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreateDedicatedHostGroupOptions model - createDedicatedHostGroupOptionsModel := new(vpcv1.CreateDedicatedHostGroupOptions) - createDedicatedHostGroupOptionsModel.Class = core.StringPtr("mx2") - createDedicatedHostGroupOptionsModel.Family = core.StringPtr("balanced") - createDedicatedHostGroupOptionsModel.Zone = zoneIdentityModel - createDedicatedHostGroupOptionsModel.Name = core.StringPtr("testString") - createDedicatedHostGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel - createDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupMembershipsOptions model + listInstanceGroupMembershipsOptionsModel := new(vpcv1.ListInstanceGroupMembershipsOptions) + listInstanceGroupMembershipsOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupMembershipsOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupMembershipsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupMembershipsOptionsModel.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.CreateDedicatedHostGroup(createDedicatedHostGroupOptionsModel) + result, response, operationErr := vpcService.ListInstanceGroupMemberships(listInstanceGroupMembershipsOptionsModel) 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.CreateDedicatedHostGroup(createDedicatedHostGroupOptionsModel) + result, response, operationErr = vpcService.ListInstanceGroupMemberships(listInstanceGroupMembershipsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -33994,46 +34339,32 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateDedicatedHostGroup(createDedicatedHostGroupOptions *CreateDedicatedHostGroupOptions)`, func() { + Describe(`ListInstanceGroupMemberships(listInstanceGroupMembershipsOptions *ListInstanceGroupMembershipsOptions)`, func() { version := "testString" - createDedicatedHostGroupPath := "/dedicated_host/groups" + listInstanceGroupMembershipsPath := "/instance_groups/testString/memberships" 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(createDedicatedHostGroupPath)) - 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.EscapedPath()).To(Equal(listInstanceGroupMembershipsPath)) + 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(10))})) // 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", `{"class": "mx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/7241e2a8-601f-11ea-8503-000c29475bed/memberships?limit=20"}, "limit": 20, "memberships": [{"created_at": "2019-01-01T12:00:00.000Z", "delete_instance_on_membership_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/memberships/8b002d86-601f-11ea-898b-000c29475bed", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "name": "my-instance-group-membership", "pool_member": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}, "status": "deleting", "updated_at": "2019-01-01T12:00:00.000Z"}], "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/7241e2a8-601f-11ea-8503-000c29475bed/memberships?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) })) }) - It(`Invoke CreateDedicatedHostGroup successfully with retries`, func() { + It(`Invoke ListInstanceGroupMemberships successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -34043,33 +34374,23 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreateDedicatedHostGroupOptions model - createDedicatedHostGroupOptionsModel := new(vpcv1.CreateDedicatedHostGroupOptions) - createDedicatedHostGroupOptionsModel.Class = core.StringPtr("mx2") - createDedicatedHostGroupOptionsModel.Family = core.StringPtr("balanced") - createDedicatedHostGroupOptionsModel.Zone = zoneIdentityModel - createDedicatedHostGroupOptionsModel.Name = core.StringPtr("testString") - createDedicatedHostGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel - createDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupMembershipsOptions model + listInstanceGroupMembershipsOptionsModel := new(vpcv1.ListInstanceGroupMembershipsOptions) + listInstanceGroupMembershipsOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupMembershipsOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupMembershipsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupMembershipsOptionsModel.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.CreateDedicatedHostGroupWithContext(ctx, createDedicatedHostGroupOptionsModel) + _, _, operationErr := vpcService.ListInstanceGroupMembershipsWithContext(ctx, listInstanceGroupMembershipsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateDedicatedHostGroup(createDedicatedHostGroupOptionsModel) + result, response, operationErr := vpcService.ListInstanceGroupMemberships(listInstanceGroupMembershipsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -34077,7 +34398,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreateDedicatedHostGroupWithContext(ctx, createDedicatedHostGroupOptionsModel) + _, _, operationErr = vpcService.ListInstanceGroupMembershipsWithContext(ctx, listInstanceGroupMembershipsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -34091,34 +34412,20 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createDedicatedHostGroupPath)) - 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.EscapedPath()).To(Equal(listInstanceGroupMembershipsPath)) + 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(10))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"class": "mx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/7241e2a8-601f-11ea-8503-000c29475bed/memberships?limit=20"}, "limit": 20, "memberships": [{"created_at": "2019-01-01T12:00:00.000Z", "delete_instance_on_membership_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/memberships/8b002d86-601f-11ea-898b-000c29475bed", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "name": "my-instance-group-membership", "pool_member": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}, "status": "deleting", "updated_at": "2019-01-01T12:00:00.000Z"}], "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/7241e2a8-601f-11ea-8503-000c29475bed/memberships?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) })) }) - It(`Invoke CreateDedicatedHostGroup successfully`, func() { + It(`Invoke ListInstanceGroupMemberships successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -34128,36 +34435,26 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreateDedicatedHostGroup(nil) + result, response, operationErr := vpcService.ListInstanceGroupMemberships(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreateDedicatedHostGroupOptions model - createDedicatedHostGroupOptionsModel := new(vpcv1.CreateDedicatedHostGroupOptions) - createDedicatedHostGroupOptionsModel.Class = core.StringPtr("mx2") - createDedicatedHostGroupOptionsModel.Family = core.StringPtr("balanced") - createDedicatedHostGroupOptionsModel.Zone = zoneIdentityModel - createDedicatedHostGroupOptionsModel.Name = core.StringPtr("testString") - createDedicatedHostGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel - createDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupMembershipsOptions model + listInstanceGroupMembershipsOptionsModel := new(vpcv1.ListInstanceGroupMembershipsOptions) + listInstanceGroupMembershipsOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupMembershipsOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupMembershipsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupMembershipsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateDedicatedHostGroup(createDedicatedHostGroupOptionsModel) + result, response, operationErr = vpcService.ListInstanceGroupMemberships(listInstanceGroupMembershipsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateDedicatedHostGroup with error: Operation validation and request error`, func() { + It(`Invoke ListInstanceGroupMemberships with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -34166,34 +34463,24 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreateDedicatedHostGroupOptions model - createDedicatedHostGroupOptionsModel := new(vpcv1.CreateDedicatedHostGroupOptions) - createDedicatedHostGroupOptionsModel.Class = core.StringPtr("mx2") - createDedicatedHostGroupOptionsModel.Family = core.StringPtr("balanced") - createDedicatedHostGroupOptionsModel.Zone = zoneIdentityModel - createDedicatedHostGroupOptionsModel.Name = core.StringPtr("testString") - createDedicatedHostGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel - createDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupMembershipsOptions model + listInstanceGroupMembershipsOptionsModel := new(vpcv1.ListInstanceGroupMembershipsOptions) + listInstanceGroupMembershipsOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupMembershipsOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupMembershipsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupMembershipsOptionsModel.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.CreateDedicatedHostGroup(createDedicatedHostGroupOptionsModel) + result, response, operationErr := vpcService.ListInstanceGroupMemberships(listInstanceGroupMembershipsOptionsModel) 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 CreateDedicatedHostGroupOptions model with no property values - createDedicatedHostGroupOptionsModelNew := new(vpcv1.CreateDedicatedHostGroupOptions) + // Construct a second instance of the ListInstanceGroupMembershipsOptions model with no property values + listInstanceGroupMembershipsOptionsModelNew := new(vpcv1.ListInstanceGroupMembershipsOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateDedicatedHostGroup(createDedicatedHostGroupOptionsModelNew) + result, response, operationErr = vpcService.ListInstanceGroupMemberships(listInstanceGroupMembershipsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -34208,10 +34495,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke CreateDedicatedHostGroup successfully`, func() { + It(`Invoke ListInstanceGroupMemberships successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -34220,25 +34507,15 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreateDedicatedHostGroupOptions model - createDedicatedHostGroupOptionsModel := new(vpcv1.CreateDedicatedHostGroupOptions) - createDedicatedHostGroupOptionsModel.Class = core.StringPtr("mx2") - createDedicatedHostGroupOptionsModel.Family = core.StringPtr("balanced") - createDedicatedHostGroupOptionsModel.Zone = zoneIdentityModel - createDedicatedHostGroupOptionsModel.Name = core.StringPtr("testString") - createDedicatedHostGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel - createDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListInstanceGroupMembershipsOptions model + listInstanceGroupMembershipsOptionsModel := new(vpcv1.ListInstanceGroupMembershipsOptions) + listInstanceGroupMembershipsOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupMembershipsOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupMembershipsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listInstanceGroupMembershipsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.CreateDedicatedHostGroup(createDedicatedHostGroupOptionsModel) + result, response, operationErr := vpcService.ListInstanceGroupMemberships(listInstanceGroupMembershipsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -34249,17 +34526,120 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(vpcv1.InstanceGroupMembershipCollection) + nextObject := new(vpcv1.InstanceGroupMembershipCollectionNext) + 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.InstanceGroupMembershipCollection) + + 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.InstanceGroupMembershipCollection) + nextObject := new(vpcv1.InstanceGroupMembershipCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { + BeforeEach(func() { + var requestNumber int = 0 + 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(listInstanceGroupMembershipsPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"memberships":[{"created_at":"2019-01-01T12:00:00.000Z","delete_instance_on_membership_delete":true,"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/memberships/8b002d86-601f-11ea-898b-000c29475bed","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","instance":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance"},"instance_template":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"a6b1a881-2ce8-41a3-80fc-36316a73f803","name":"my-instance-template"},"name":"my-instance-group-membership","pool_member":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004","id":"70294e14-4e61-11e8-bcf4-0242ac110004"},"status":"deleting","updated_at":"2019-01-01T12:00:00.000Z"}]}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"memberships":[{"created_at":"2019-01-01T12:00:00.000Z","delete_instance_on_membership_delete":true,"href":"https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/memberships/8b002d86-601f-11ea-898b-000c29475bed","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","instance":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance"},"instance_template":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"a6b1a881-2ce8-41a3-80fc-36316a73f803","name":"my-instance-template"},"name":"my-instance-group-membership","pool_member":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004","id":"70294e14-4e61-11e8-bcf4-0242ac110004"},"status":"deleting","updated_at":"2019-01-01T12:00:00.000Z"}]}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use InstanceGroupMembershipsPager.GetNext 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()) + + listInstanceGroupMembershipsOptionsModel := &vpcv1.ListInstanceGroupMembershipsOptions{ + InstanceGroupID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewInstanceGroupMembershipsPager(listInstanceGroupMembershipsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.InstanceGroupMembership + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) + }) + It(`Use InstanceGroupMembershipsPager.GetAll 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()) + + listInstanceGroupMembershipsOptionsModel := &vpcv1.ListInstanceGroupMembershipsOptions{ + InstanceGroupID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewInstanceGroupMembershipsPager(listInstanceGroupMembershipsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) + }) + }) }) - Describe(`DeleteDedicatedHostGroup(deleteDedicatedHostGroupOptions *DeleteDedicatedHostGroupOptions)`, func() { + Describe(`DeleteInstanceGroupMembership(deleteInstanceGroupMembershipOptions *DeleteInstanceGroupMembershipOptions)`, func() { version := "testString" - deleteDedicatedHostGroupPath := "/dedicated_host/groups/testString" + deleteInstanceGroupMembershipPath := "/instance_groups/testString/memberships/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(deleteDedicatedHostGroupPath)) + Expect(req.URL.EscapedPath()).To(Equal(deleteInstanceGroupMembershipPath)) Expect(req.Method).To(Equal("DELETE")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -34267,7 +34647,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(204) })) }) - It(`Invoke DeleteDedicatedHostGroup successfully`, func() { + It(`Invoke DeleteInstanceGroupMembership successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -34277,21 +34657,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.DeleteDedicatedHostGroup(nil) + response, operationErr := vpcService.DeleteInstanceGroupMembership(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) - // Construct an instance of the DeleteDedicatedHostGroupOptions model - deleteDedicatedHostGroupOptionsModel := new(vpcv1.DeleteDedicatedHostGroupOptions) - deleteDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") - deleteDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteInstanceGroupMembershipOptions model + deleteInstanceGroupMembershipOptionsModel := new(vpcv1.DeleteInstanceGroupMembershipOptions) + deleteInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") + deleteInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") + deleteInstanceGroupMembershipOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteDedicatedHostGroup(deleteDedicatedHostGroupOptionsModel) + response, operationErr = vpcService.DeleteInstanceGroupMembership(deleteInstanceGroupMembershipOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) }) - It(`Invoke DeleteDedicatedHostGroup with error: Operation validation and request error`, func() { + It(`Invoke DeleteInstanceGroupMembership with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -34300,21 +34681,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteDedicatedHostGroupOptions model - deleteDedicatedHostGroupOptionsModel := new(vpcv1.DeleteDedicatedHostGroupOptions) - deleteDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") - deleteDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteInstanceGroupMembershipOptions model + deleteInstanceGroupMembershipOptionsModel := new(vpcv1.DeleteInstanceGroupMembershipOptions) + deleteInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") + deleteInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") + deleteInstanceGroupMembershipOptionsModel.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.DeleteDedicatedHostGroup(deleteDedicatedHostGroupOptionsModel) + response, operationErr := vpcService.DeleteInstanceGroupMembership(deleteInstanceGroupMembershipOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - // Construct a second instance of the DeleteDedicatedHostGroupOptions model with no property values - deleteDedicatedHostGroupOptionsModelNew := new(vpcv1.DeleteDedicatedHostGroupOptions) + // Construct a second instance of the DeleteInstanceGroupMembershipOptions model with no property values + deleteInstanceGroupMembershipOptionsModelNew := new(vpcv1.DeleteInstanceGroupMembershipOptions) // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteDedicatedHostGroup(deleteDedicatedHostGroupOptionsModelNew) + response, operationErr = vpcService.DeleteInstanceGroupMembership(deleteInstanceGroupMembershipOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) }) @@ -34323,16 +34705,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetDedicatedHostGroup(getDedicatedHostGroupOptions *GetDedicatedHostGroupOptions) - Operation response error`, func() { + Describe(`GetInstanceGroupMembership(getInstanceGroupMembershipOptions *GetInstanceGroupMembershipOptions) - Operation response error`, func() { version := "testString" - getDedicatedHostGroupPath := "/dedicated_host/groups/testString" + getInstanceGroupMembershipPath := "/instance_groups/testString/memberships/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(getDedicatedHostGroupPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupMembershipPath)) 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))})) @@ -34341,7 +34723,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetDedicatedHostGroup with error: Operation response processing error`, func() { + It(`Invoke GetInstanceGroupMembership with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -34350,19 +34732,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetDedicatedHostGroupOptions model - getDedicatedHostGroupOptionsModel := new(vpcv1.GetDedicatedHostGroupOptions) - getDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") - getDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupMembershipOptions model + getInstanceGroupMembershipOptionsModel := new(vpcv1.GetInstanceGroupMembershipOptions) + getInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") + getInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupMembershipOptionsModel.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.GetDedicatedHostGroup(getDedicatedHostGroupOptionsModel) + result, response, operationErr := vpcService.GetInstanceGroupMembership(getInstanceGroupMembershipOptionsModel) 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.GetDedicatedHostGroup(getDedicatedHostGroupOptionsModel) + result, response, operationErr = vpcService.GetInstanceGroupMembership(getInstanceGroupMembershipOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -34372,16 +34755,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetDedicatedHostGroup(getDedicatedHostGroupOptions *GetDedicatedHostGroupOptions)`, func() { + Describe(`GetInstanceGroupMembership(getInstanceGroupMembershipOptions *GetInstanceGroupMembershipOptions)`, func() { version := "testString" - getDedicatedHostGroupPath := "/dedicated_host/groups/testString" + getInstanceGroupMembershipPath := "/instance_groups/testString/memberships/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(getDedicatedHostGroupPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupMembershipPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -34392,10 +34775,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"class": "mx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "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", `{"created_at": "2019-01-01T12:00:00.000Z", "delete_instance_on_membership_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/memberships/8b002d86-601f-11ea-898b-000c29475bed", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "name": "my-instance-group-membership", "pool_member": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}, "status": "deleting", "updated_at": "2019-01-01T12:00:00.000Z"}`) })) }) - It(`Invoke GetDedicatedHostGroup successfully with retries`, func() { + It(`Invoke GetInstanceGroupMembership successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -34405,21 +34788,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetDedicatedHostGroupOptions model - getDedicatedHostGroupOptionsModel := new(vpcv1.GetDedicatedHostGroupOptions) - getDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") - getDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupMembershipOptions model + getInstanceGroupMembershipOptionsModel := new(vpcv1.GetInstanceGroupMembershipOptions) + getInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") + getInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupMembershipOptionsModel.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.GetDedicatedHostGroupWithContext(ctx, getDedicatedHostGroupOptionsModel) + _, _, operationErr := vpcService.GetInstanceGroupMembershipWithContext(ctx, getInstanceGroupMembershipOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetDedicatedHostGroup(getDedicatedHostGroupOptionsModel) + result, response, operationErr := vpcService.GetInstanceGroupMembership(getInstanceGroupMembershipOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -34427,7 +34811,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetDedicatedHostGroupWithContext(ctx, getDedicatedHostGroupOptionsModel) + _, _, operationErr = vpcService.GetInstanceGroupMembershipWithContext(ctx, getInstanceGroupMembershipOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -34441,7 +34825,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getDedicatedHostGroupPath)) + Expect(req.URL.EscapedPath()).To(Equal(getInstanceGroupMembershipPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -34449,10 +34833,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"class": "mx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "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", `{"created_at": "2019-01-01T12:00:00.000Z", "delete_instance_on_membership_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/memberships/8b002d86-601f-11ea-898b-000c29475bed", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "name": "my-instance-group-membership", "pool_member": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}, "status": "deleting", "updated_at": "2019-01-01T12:00:00.000Z"}`) })) }) - It(`Invoke GetDedicatedHostGroup successfully`, func() { + It(`Invoke GetInstanceGroupMembership successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -34462,24 +34846,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetDedicatedHostGroup(nil) + result, response, operationErr := vpcService.GetInstanceGroupMembership(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetDedicatedHostGroupOptions model - getDedicatedHostGroupOptionsModel := new(vpcv1.GetDedicatedHostGroupOptions) - getDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") - getDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupMembershipOptions model + getInstanceGroupMembershipOptionsModel := new(vpcv1.GetInstanceGroupMembershipOptions) + getInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") + getInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupMembershipOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetDedicatedHostGroup(getDedicatedHostGroupOptionsModel) + result, response, operationErr = vpcService.GetInstanceGroupMembership(getInstanceGroupMembershipOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetDedicatedHostGroup with error: Operation validation and request error`, func() { + It(`Invoke GetInstanceGroupMembership with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -34488,22 +34873,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetDedicatedHostGroupOptions model - getDedicatedHostGroupOptionsModel := new(vpcv1.GetDedicatedHostGroupOptions) - getDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") - getDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupMembershipOptions model + getInstanceGroupMembershipOptionsModel := new(vpcv1.GetInstanceGroupMembershipOptions) + getInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") + getInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupMembershipOptionsModel.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.GetDedicatedHostGroup(getDedicatedHostGroupOptionsModel) + result, response, operationErr := vpcService.GetInstanceGroupMembership(getInstanceGroupMembershipOptionsModel) 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 GetDedicatedHostGroupOptions model with no property values - getDedicatedHostGroupOptionsModelNew := new(vpcv1.GetDedicatedHostGroupOptions) + // Construct a second instance of the GetInstanceGroupMembershipOptions model with no property values + getInstanceGroupMembershipOptionsModelNew := new(vpcv1.GetInstanceGroupMembershipOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetDedicatedHostGroup(getDedicatedHostGroupOptionsModelNew) + result, response, operationErr = vpcService.GetInstanceGroupMembership(getInstanceGroupMembershipOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -34521,7 +34907,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetDedicatedHostGroup successfully`, func() { + It(`Invoke GetInstanceGroupMembership successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -34530,13 +34916,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetDedicatedHostGroupOptions model - getDedicatedHostGroupOptionsModel := new(vpcv1.GetDedicatedHostGroupOptions) - getDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") - getDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetInstanceGroupMembershipOptions model + getInstanceGroupMembershipOptionsModel := new(vpcv1.GetInstanceGroupMembershipOptions) + getInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") + getInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") + getInstanceGroupMembershipOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetDedicatedHostGroup(getDedicatedHostGroupOptionsModel) + result, response, operationErr := vpcService.GetInstanceGroupMembership(getInstanceGroupMembershipOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -34548,16 +34935,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateDedicatedHostGroup(updateDedicatedHostGroupOptions *UpdateDedicatedHostGroupOptions) - Operation response error`, func() { + Describe(`UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptions *UpdateInstanceGroupMembershipOptions) - Operation response error`, func() { version := "testString" - updateDedicatedHostGroupPath := "/dedicated_host/groups/testString" + updateInstanceGroupMembershipPath := "/instance_groups/testString/memberships/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(updateDedicatedHostGroupPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupMembershipPath)) 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))})) @@ -34566,7 +34953,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateDedicatedHostGroup with error: Operation response processing error`, func() { + It(`Invoke UpdateInstanceGroupMembership with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -34575,26 +34962,27 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DedicatedHostGroupPatch model - dedicatedHostGroupPatchModel := new(vpcv1.DedicatedHostGroupPatch) - dedicatedHostGroupPatchModel.Name = core.StringPtr("my-host-group-updated") - dedicatedHostGroupPatchModelAsPatch, asPatchErr := dedicatedHostGroupPatchModel.AsPatch() + // Construct an instance of the InstanceGroupMembershipPatch model + instanceGroupMembershipPatchModel := new(vpcv1.InstanceGroupMembershipPatch) + instanceGroupMembershipPatchModel.Name = core.StringPtr("my-instance-group-membership") + instanceGroupMembershipPatchModelAsPatch, asPatchErr := instanceGroupMembershipPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateDedicatedHostGroupOptions model - updateDedicatedHostGroupOptionsModel := new(vpcv1.UpdateDedicatedHostGroupOptions) - updateDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") - updateDedicatedHostGroupOptionsModel.DedicatedHostGroupPatch = dedicatedHostGroupPatchModelAsPatch - updateDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceGroupMembershipOptions model + updateInstanceGroupMembershipOptionsModel := new(vpcv1.UpdateInstanceGroupMembershipOptions) + updateInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") + updateInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupMembershipOptionsModel.InstanceGroupMembershipPatch = instanceGroupMembershipPatchModelAsPatch + updateInstanceGroupMembershipOptionsModel.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.UpdateDedicatedHostGroup(updateDedicatedHostGroupOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptionsModel) 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.UpdateDedicatedHostGroup(updateDedicatedHostGroupOptionsModel) + result, response, operationErr = vpcService.UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -34604,16 +34992,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateDedicatedHostGroup(updateDedicatedHostGroupOptions *UpdateDedicatedHostGroupOptions)`, func() { + Describe(`UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptions *UpdateInstanceGroupMembershipOptions)`, func() { version := "testString" - updateDedicatedHostGroupPath := "/dedicated_host/groups/testString" + updateInstanceGroupMembershipPath := "/instance_groups/testString/memberships/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(updateDedicatedHostGroupPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupMembershipPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -34640,10 +35028,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"class": "mx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "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", `{"created_at": "2019-01-01T12:00:00.000Z", "delete_instance_on_membership_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/memberships/8b002d86-601f-11ea-898b-000c29475bed", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "name": "my-instance-group-membership", "pool_member": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}, "status": "deleting", "updated_at": "2019-01-01T12:00:00.000Z"}`) })) }) - It(`Invoke UpdateDedicatedHostGroup successfully with retries`, func() { + It(`Invoke UpdateInstanceGroupMembership successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -34653,28 +35041,29 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the DedicatedHostGroupPatch model - dedicatedHostGroupPatchModel := new(vpcv1.DedicatedHostGroupPatch) - dedicatedHostGroupPatchModel.Name = core.StringPtr("my-host-group-updated") - dedicatedHostGroupPatchModelAsPatch, asPatchErr := dedicatedHostGroupPatchModel.AsPatch() + // Construct an instance of the InstanceGroupMembershipPatch model + instanceGroupMembershipPatchModel := new(vpcv1.InstanceGroupMembershipPatch) + instanceGroupMembershipPatchModel.Name = core.StringPtr("my-instance-group-membership") + instanceGroupMembershipPatchModelAsPatch, asPatchErr := instanceGroupMembershipPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateDedicatedHostGroupOptions model - updateDedicatedHostGroupOptionsModel := new(vpcv1.UpdateDedicatedHostGroupOptions) - updateDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") - updateDedicatedHostGroupOptionsModel.DedicatedHostGroupPatch = dedicatedHostGroupPatchModelAsPatch - updateDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceGroupMembershipOptions model + updateInstanceGroupMembershipOptionsModel := new(vpcv1.UpdateInstanceGroupMembershipOptions) + updateInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") + updateInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupMembershipOptionsModel.InstanceGroupMembershipPatch = instanceGroupMembershipPatchModelAsPatch + updateInstanceGroupMembershipOptionsModel.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.UpdateDedicatedHostGroupWithContext(ctx, updateDedicatedHostGroupOptionsModel) + _, _, operationErr := vpcService.UpdateInstanceGroupMembershipWithContext(ctx, updateInstanceGroupMembershipOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateDedicatedHostGroup(updateDedicatedHostGroupOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -34682,7 +35071,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateDedicatedHostGroupWithContext(ctx, updateDedicatedHostGroupOptionsModel) + _, _, operationErr = vpcService.UpdateInstanceGroupMembershipWithContext(ctx, updateInstanceGroupMembershipOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -34696,7 +35085,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateDedicatedHostGroupPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateInstanceGroupMembershipPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -34720,10 +35109,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"class": "mx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "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", `{"created_at": "2019-01-01T12:00:00.000Z", "delete_instance_on_membership_delete": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/memberships/8b002d86-601f-11ea-898b-000c29475bed", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-instance-template"}, "name": "my-instance-group-membership", "pool_member": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004/members/80294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}, "status": "deleting", "updated_at": "2019-01-01T12:00:00.000Z"}`) })) }) - It(`Invoke UpdateDedicatedHostGroup successfully`, func() { + It(`Invoke UpdateInstanceGroupMembership successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -34733,31 +35122,32 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateDedicatedHostGroup(nil) + result, response, operationErr := vpcService.UpdateInstanceGroupMembership(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the DedicatedHostGroupPatch model - dedicatedHostGroupPatchModel := new(vpcv1.DedicatedHostGroupPatch) - dedicatedHostGroupPatchModel.Name = core.StringPtr("my-host-group-updated") - dedicatedHostGroupPatchModelAsPatch, asPatchErr := dedicatedHostGroupPatchModel.AsPatch() + // Construct an instance of the InstanceGroupMembershipPatch model + instanceGroupMembershipPatchModel := new(vpcv1.InstanceGroupMembershipPatch) + instanceGroupMembershipPatchModel.Name = core.StringPtr("my-instance-group-membership") + instanceGroupMembershipPatchModelAsPatch, asPatchErr := instanceGroupMembershipPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateDedicatedHostGroupOptions model - updateDedicatedHostGroupOptionsModel := new(vpcv1.UpdateDedicatedHostGroupOptions) - updateDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") - updateDedicatedHostGroupOptionsModel.DedicatedHostGroupPatch = dedicatedHostGroupPatchModelAsPatch - updateDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceGroupMembershipOptions model + updateInstanceGroupMembershipOptionsModel := new(vpcv1.UpdateInstanceGroupMembershipOptions) + updateInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") + updateInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupMembershipOptionsModel.InstanceGroupMembershipPatch = instanceGroupMembershipPatchModelAsPatch + updateInstanceGroupMembershipOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateDedicatedHostGroup(updateDedicatedHostGroupOptionsModel) + result, response, operationErr = vpcService.UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateDedicatedHostGroup with error: Operation validation and request error`, func() { + It(`Invoke UpdateInstanceGroupMembership with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -34766,29 +35156,30 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DedicatedHostGroupPatch model - dedicatedHostGroupPatchModel := new(vpcv1.DedicatedHostGroupPatch) - dedicatedHostGroupPatchModel.Name = core.StringPtr("my-host-group-updated") - dedicatedHostGroupPatchModelAsPatch, asPatchErr := dedicatedHostGroupPatchModel.AsPatch() + // Construct an instance of the InstanceGroupMembershipPatch model + instanceGroupMembershipPatchModel := new(vpcv1.InstanceGroupMembershipPatch) + instanceGroupMembershipPatchModel.Name = core.StringPtr("my-instance-group-membership") + instanceGroupMembershipPatchModelAsPatch, asPatchErr := instanceGroupMembershipPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateDedicatedHostGroupOptions model - updateDedicatedHostGroupOptionsModel := new(vpcv1.UpdateDedicatedHostGroupOptions) - updateDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") - updateDedicatedHostGroupOptionsModel.DedicatedHostGroupPatch = dedicatedHostGroupPatchModelAsPatch - updateDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceGroupMembershipOptions model + updateInstanceGroupMembershipOptionsModel := new(vpcv1.UpdateInstanceGroupMembershipOptions) + updateInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") + updateInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupMembershipOptionsModel.InstanceGroupMembershipPatch = instanceGroupMembershipPatchModelAsPatch + updateInstanceGroupMembershipOptionsModel.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.UpdateDedicatedHostGroup(updateDedicatedHostGroupOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptionsModel) 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 UpdateDedicatedHostGroupOptions model with no property values - updateDedicatedHostGroupOptionsModelNew := new(vpcv1.UpdateDedicatedHostGroupOptions) + // Construct a second instance of the UpdateInstanceGroupMembershipOptions model with no property values + updateInstanceGroupMembershipOptionsModelNew := new(vpcv1.UpdateInstanceGroupMembershipOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateDedicatedHostGroup(updateDedicatedHostGroupOptionsModelNew) + result, response, operationErr = vpcService.UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -34806,7 +35197,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateDedicatedHostGroup successfully`, func() { + It(`Invoke UpdateInstanceGroupMembership successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -34815,20 +35206,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DedicatedHostGroupPatch model - dedicatedHostGroupPatchModel := new(vpcv1.DedicatedHostGroupPatch) - dedicatedHostGroupPatchModel.Name = core.StringPtr("my-host-group-updated") - dedicatedHostGroupPatchModelAsPatch, asPatchErr := dedicatedHostGroupPatchModel.AsPatch() + // Construct an instance of the InstanceGroupMembershipPatch model + instanceGroupMembershipPatchModel := new(vpcv1.InstanceGroupMembershipPatch) + instanceGroupMembershipPatchModel.Name = core.StringPtr("my-instance-group-membership") + instanceGroupMembershipPatchModelAsPatch, asPatchErr := instanceGroupMembershipPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateDedicatedHostGroupOptions model - updateDedicatedHostGroupOptionsModel := new(vpcv1.UpdateDedicatedHostGroupOptions) - updateDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") - updateDedicatedHostGroupOptionsModel.DedicatedHostGroupPatch = dedicatedHostGroupPatchModelAsPatch - updateDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateInstanceGroupMembershipOptions model + updateInstanceGroupMembershipOptionsModel := new(vpcv1.UpdateInstanceGroupMembershipOptions) + updateInstanceGroupMembershipOptionsModel.InstanceGroupID = core.StringPtr("testString") + updateInstanceGroupMembershipOptionsModel.ID = core.StringPtr("testString") + updateInstanceGroupMembershipOptionsModel.InstanceGroupMembershipPatch = instanceGroupMembershipPatchModelAsPatch + updateInstanceGroupMembershipOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.UpdateDedicatedHostGroup(updateDedicatedHostGroupOptionsModel) + result, response, operationErr := vpcService.UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -34840,27 +35232,30 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListDedicatedHostProfiles(listDedicatedHostProfilesOptions *ListDedicatedHostProfilesOptions) - Operation response error`, func() { + Describe(`ListDedicatedHostGroups(listDedicatedHostGroupsOptions *ListDedicatedHostGroupsOptions) - Operation response error`, func() { version := "testString" - listDedicatedHostProfilesPath := "/dedicated_host/profiles" + listDedicatedHostGroupsPath := "/dedicated_host/groups" 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(listDedicatedHostProfilesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostGroupsPath)) 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(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"us-south-1"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListDedicatedHostProfiles with error: Operation response processing error`, func() { + It(`Invoke ListDedicatedHostGroups with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -34869,20 +35264,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListDedicatedHostProfilesOptions model - listDedicatedHostProfilesOptionsModel := new(vpcv1.ListDedicatedHostProfilesOptions) - listDedicatedHostProfilesOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listDedicatedHostProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDedicatedHostGroupsOptions model + listDedicatedHostGroupsOptionsModel := new(vpcv1.ListDedicatedHostGroupsOptions) + listDedicatedHostGroupsOptionsModel.Start = core.StringPtr("testString") + listDedicatedHostGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listDedicatedHostGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listDedicatedHostGroupsOptionsModel.ZoneName = core.StringPtr("us-south-1") + listDedicatedHostGroupsOptionsModel.Name = core.StringPtr("testString") + listDedicatedHostGroupsOptionsModel.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.ListDedicatedHostProfiles(listDedicatedHostProfilesOptionsModel) + result, response, operationErr := vpcService.ListDedicatedHostGroups(listDedicatedHostGroupsOptionsModel) 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.ListDedicatedHostProfiles(listDedicatedHostProfilesOptionsModel) + result, response, operationErr = vpcService.ListDedicatedHostGroups(listDedicatedHostGroupsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -34892,32 +35290,35 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListDedicatedHostProfiles(listDedicatedHostProfilesOptions *ListDedicatedHostProfilesOptions)`, func() { + Describe(`ListDedicatedHostGroups(listDedicatedHostGroupsOptions *ListDedicatedHostGroupsOptions)`, func() { version := "testString" - listDedicatedHostProfilesPath := "/dedicated_host/profiles" + listDedicatedHostGroupsPath := "/dedicated_host/groups" 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(listDedicatedHostProfilesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostGroupsPath)) 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(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"us-south-1"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) // 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/dedicated_host/profiles?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/profiles?start=9da91&limit=20"}, "profiles": [{"class": "mx2", "disks": [{"interface_type": {"type": "fixed", "value": "nvme"}, "quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 3200}, "supported_instance_interface_types": {"type": "fixed", "value": ["nvme"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": {"type": "fixed", "value": 16}, "name": "mx2-host-152x1216", "socket_count": {"type": "fixed", "value": 2}, "status": "current", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "vcpu_architecture": {"type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"type": "fixed", "value": "intel"}}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups?limit=20"}, "groups": [{"class": "mx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) })) }) - It(`Invoke ListDedicatedHostProfiles successfully with retries`, func() { + It(`Invoke ListDedicatedHostGroups successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -34927,22 +35328,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListDedicatedHostProfilesOptions model - listDedicatedHostProfilesOptionsModel := new(vpcv1.ListDedicatedHostProfilesOptions) - listDedicatedHostProfilesOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listDedicatedHostProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDedicatedHostGroupsOptions model + listDedicatedHostGroupsOptionsModel := new(vpcv1.ListDedicatedHostGroupsOptions) + listDedicatedHostGroupsOptionsModel.Start = core.StringPtr("testString") + listDedicatedHostGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listDedicatedHostGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listDedicatedHostGroupsOptionsModel.ZoneName = core.StringPtr("us-south-1") + listDedicatedHostGroupsOptionsModel.Name = core.StringPtr("testString") + listDedicatedHostGroupsOptionsModel.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.ListDedicatedHostProfilesWithContext(ctx, listDedicatedHostProfilesOptionsModel) + _, _, operationErr := vpcService.ListDedicatedHostGroupsWithContext(ctx, listDedicatedHostGroupsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListDedicatedHostProfiles(listDedicatedHostProfilesOptionsModel) + result, response, operationErr := vpcService.ListDedicatedHostGroups(listDedicatedHostGroupsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -34950,7 +35354,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListDedicatedHostProfilesWithContext(ctx, listDedicatedHostProfilesOptionsModel) + _, _, operationErr = vpcService.ListDedicatedHostGroupsWithContext(ctx, listDedicatedHostGroupsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -34964,20 +35368,23 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostProfilesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostGroupsPath)) 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(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"us-south-1"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) // 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/dedicated_host/profiles?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/profiles?start=9da91&limit=20"}, "profiles": [{"class": "mx2", "disks": [{"interface_type": {"type": "fixed", "value": "nvme"}, "quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 3200}, "supported_instance_interface_types": {"type": "fixed", "value": ["nvme"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": {"type": "fixed", "value": 16}, "name": "mx2-host-152x1216", "socket_count": {"type": "fixed", "value": 2}, "status": "current", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "vcpu_architecture": {"type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"type": "fixed", "value": "intel"}}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups?limit=20"}, "groups": [{"class": "mx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) })) }) - It(`Invoke ListDedicatedHostProfiles successfully`, func() { + It(`Invoke ListDedicatedHostGroups successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -34987,25 +35394,28 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListDedicatedHostProfiles(nil) + result, response, operationErr := vpcService.ListDedicatedHostGroups(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListDedicatedHostProfilesOptions model - listDedicatedHostProfilesOptionsModel := new(vpcv1.ListDedicatedHostProfilesOptions) - listDedicatedHostProfilesOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listDedicatedHostProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDedicatedHostGroupsOptions model + listDedicatedHostGroupsOptionsModel := new(vpcv1.ListDedicatedHostGroupsOptions) + listDedicatedHostGroupsOptionsModel.Start = core.StringPtr("testString") + listDedicatedHostGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listDedicatedHostGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listDedicatedHostGroupsOptionsModel.ZoneName = core.StringPtr("us-south-1") + listDedicatedHostGroupsOptionsModel.Name = core.StringPtr("testString") + listDedicatedHostGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListDedicatedHostProfiles(listDedicatedHostProfilesOptionsModel) + result, response, operationErr = vpcService.ListDedicatedHostGroups(listDedicatedHostGroupsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListDedicatedHostProfiles with error: Operation request error`, func() { + It(`Invoke ListDedicatedHostGroups with error: Operation request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -35014,15 +35424,18 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListDedicatedHostProfilesOptions model - listDedicatedHostProfilesOptionsModel := new(vpcv1.ListDedicatedHostProfilesOptions) - listDedicatedHostProfilesOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listDedicatedHostProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDedicatedHostGroupsOptions model + listDedicatedHostGroupsOptionsModel := new(vpcv1.ListDedicatedHostGroupsOptions) + listDedicatedHostGroupsOptionsModel.Start = core.StringPtr("testString") + listDedicatedHostGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listDedicatedHostGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listDedicatedHostGroupsOptionsModel.ZoneName = core.StringPtr("us-south-1") + listDedicatedHostGroupsOptionsModel.Name = core.StringPtr("testString") + listDedicatedHostGroupsOptionsModel.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.ListDedicatedHostProfiles(listDedicatedHostProfilesOptionsModel) + result, response, operationErr := vpcService.ListDedicatedHostGroups(listDedicatedHostGroupsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) @@ -35041,7 +35454,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListDedicatedHostProfiles successfully`, func() { + It(`Invoke ListDedicatedHostGroups successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -35050,14 +35463,17 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListDedicatedHostProfilesOptions model - listDedicatedHostProfilesOptionsModel := new(vpcv1.ListDedicatedHostProfilesOptions) - listDedicatedHostProfilesOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listDedicatedHostProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDedicatedHostGroupsOptions model + listDedicatedHostGroupsOptionsModel := new(vpcv1.ListDedicatedHostGroupsOptions) + listDedicatedHostGroupsOptionsModel.Start = core.StringPtr("testString") + listDedicatedHostGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listDedicatedHostGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listDedicatedHostGroupsOptionsModel.ZoneName = core.StringPtr("us-south-1") + listDedicatedHostGroupsOptionsModel.Name = core.StringPtr("testString") + listDedicatedHostGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListDedicatedHostProfiles(listDedicatedHostProfilesOptionsModel) + result, response, operationErr := vpcService.ListDedicatedHostGroups(listDedicatedHostGroupsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -35070,8 +35486,8 @@ var _ = Describe(`VpcV1`, func() { }) Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.DedicatedHostProfileCollection) - nextObject := new(vpcv1.DedicatedHostProfileCollectionNext) + responseObject := new(vpcv1.DedicatedHostGroupCollection) + nextObject := new(vpcv1.DedicatedHostGroupCollectionNext) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -35080,15 +35496,15 @@ var _ = Describe(`VpcV1`, func() { Expect(value).To(Equal(core.StringPtr("abc-123"))) }) It(`Invoke GetNextStart without a "Next" property in the response`, func() { - responseObject := new(vpcv1.DedicatedHostProfileCollection) + responseObject := new(vpcv1.DedicatedHostGroupCollection) 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.DedicatedHostProfileCollection) - nextObject := new(vpcv1.DedicatedHostProfileCollectionNext) + responseObject := new(vpcv1.DedicatedHostGroupCollection) + nextObject := new(vpcv1.DedicatedHostGroupCollectionNext) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -35104,7 +35520,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostProfilesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostGroupsPath)) Expect(req.Method).To(Equal("GET")) // Set mock response @@ -35112,15 +35528,15 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) requestNumber++ if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"profiles":[{"class":"mx2","disks":[{"interface_type":{"type":"fixed","value":"nvme"},"quantity":{"type":"fixed","value":4},"size":{"type":"fixed","value":3200},"supported_instance_interface_types":{"type":"fixed","value":["nvme"]}}],"family":"balanced","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a","memory":{"type":"fixed","value":16},"name":"mx2-host-152x1216","socket_count":{"type":"fixed","value":2},"status":"current","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16"}],"vcpu_architecture":{"type":"fixed","value":"amd64"},"vcpu_count":{"type":"fixed","value":16},"vcpu_manufacturer":{"type":"fixed","value":"intel"}}]}`) + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"groups":[{"class":"mx2","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","dedicated_hosts":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-host","resource_type":"dedicated_host"}],"family":"balanced","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-host-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"dedicated_host_group","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16"}],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}]}`) } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"profiles":[{"class":"mx2","disks":[{"interface_type":{"type":"fixed","value":"nvme"},"quantity":{"type":"fixed","value":4},"size":{"type":"fixed","value":3200},"supported_instance_interface_types":{"type":"fixed","value":["nvme"]}}],"family":"balanced","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a","memory":{"type":"fixed","value":16},"name":"mx2-host-152x1216","socket_count":{"type":"fixed","value":2},"status":"current","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16"}],"vcpu_architecture":{"type":"fixed","value":"amd64"},"vcpu_count":{"type":"fixed","value":16},"vcpu_manufacturer":{"type":"fixed","value":"intel"}}]}`) + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"groups":[{"class":"mx2","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","dedicated_hosts":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-host","resource_type":"dedicated_host"}],"family":"balanced","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-host-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"dedicated_host_group","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16"}],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}]}`) } else { res.WriteHeader(400) } })) }) - It(`Use DedicatedHostProfilesPager.GetNext successfully`, func() { + It(`Use DedicatedHostGroupsPager.GetNext successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -35129,15 +35545,18 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listDedicatedHostProfilesOptionsModel := &vpcv1.ListDedicatedHostProfilesOptions{ - Limit: core.Int64Ptr(int64(10)), + listDedicatedHostGroupsOptionsModel := &vpcv1.ListDedicatedHostGroupsOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + ZoneName: core.StringPtr("us-south-1"), + Name: core.StringPtr("testString"), } - pager, err := vpcService.NewDedicatedHostProfilesPager(listDedicatedHostProfilesOptionsModel) + pager, err := vpcService.NewDedicatedHostGroupsPager(listDedicatedHostGroupsOptionsModel) Expect(err).To(BeNil()) Expect(pager).ToNot(BeNil()) - var allResults []vpcv1.DedicatedHostProfile + var allResults []vpcv1.DedicatedHostGroup for pager.HasNext() { nextPage, err := pager.GetNext() Expect(err).To(BeNil()) @@ -35146,7 +35565,7 @@ var _ = Describe(`VpcV1`, func() { } Expect(len(allResults)).To(Equal(2)) }) - It(`Use DedicatedHostProfilesPager.GetAll successfully`, func() { + It(`Use DedicatedHostGroupsPager.GetAll successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -35155,11 +35574,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listDedicatedHostProfilesOptionsModel := &vpcv1.ListDedicatedHostProfilesOptions{ - Limit: core.Int64Ptr(int64(10)), + listDedicatedHostGroupsOptionsModel := &vpcv1.ListDedicatedHostGroupsOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + ZoneName: core.StringPtr("us-south-1"), + Name: core.StringPtr("testString"), } - pager, err := vpcService.NewDedicatedHostProfilesPager(listDedicatedHostProfilesOptionsModel) + pager, err := vpcService.NewDedicatedHostGroupsPager(listDedicatedHostGroupsOptionsModel) Expect(err).To(BeNil()) Expect(pager).ToNot(BeNil()) @@ -35170,25 +35592,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetDedicatedHostProfile(getDedicatedHostProfileOptions *GetDedicatedHostProfileOptions) - Operation response error`, func() { + Describe(`CreateDedicatedHostGroup(createDedicatedHostGroupOptions *CreateDedicatedHostGroupOptions) - Operation response error`, func() { version := "testString" - getDedicatedHostProfilePath := "/dedicated_host/profiles/testString" + createDedicatedHostGroupPath := "/dedicated_host/groups" 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(getDedicatedHostProfilePath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createDedicatedHostGroupPath)) + 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(200) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetDedicatedHostProfile with error: Operation response processing error`, func() { + It(`Invoke CreateDedicatedHostGroup with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -35197,19 +35619,31 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetDedicatedHostProfileOptions model - getDedicatedHostProfileOptionsModel := new(vpcv1.GetDedicatedHostProfileOptions) - getDedicatedHostProfileOptionsModel.Name = core.StringPtr("testString") - getDedicatedHostProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreateDedicatedHostGroupOptions model + createDedicatedHostGroupOptionsModel := new(vpcv1.CreateDedicatedHostGroupOptions) + createDedicatedHostGroupOptionsModel.Class = core.StringPtr("mx2") + createDedicatedHostGroupOptionsModel.Family = core.StringPtr("balanced") + createDedicatedHostGroupOptionsModel.Zone = zoneIdentityModel + createDedicatedHostGroupOptionsModel.Name = core.StringPtr("testString") + createDedicatedHostGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel + createDedicatedHostGroupOptionsModel.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.GetDedicatedHostProfile(getDedicatedHostProfileOptionsModel) + result, response, operationErr := vpcService.CreateDedicatedHostGroup(createDedicatedHostGroupOptionsModel) 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.GetDedicatedHostProfile(getDedicatedHostProfileOptionsModel) + result, response, operationErr = vpcService.CreateDedicatedHostGroup(createDedicatedHostGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -35219,17 +35653,33 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetDedicatedHostProfile(getDedicatedHostProfileOptions *GetDedicatedHostProfileOptions)`, func() { + Describe(`CreateDedicatedHostGroup(createDedicatedHostGroupOptions *CreateDedicatedHostGroupOptions)`, func() { version := "testString" - getDedicatedHostProfilePath := "/dedicated_host/profiles/testString" + createDedicatedHostGroupPath := "/dedicated_host/groups" 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(getDedicatedHostProfilePath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createDedicatedHostGroupPath)) + 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))})) @@ -35238,11 +35688,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"class": "mx2", "disks": [{"interface_type": {"type": "fixed", "value": "nvme"}, "quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 3200}, "supported_instance_interface_types": {"type": "fixed", "value": ["nvme"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": {"type": "fixed", "value": 16}, "name": "mx2-host-152x1216", "socket_count": {"type": "fixed", "value": 2}, "status": "current", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "vcpu_architecture": {"type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"type": "fixed", "value": "intel"}}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"class": "mx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke GetDedicatedHostProfile successfully with retries`, func() { + It(`Invoke CreateDedicatedHostGroup successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -35252,21 +35702,33 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetDedicatedHostProfileOptions model - getDedicatedHostProfileOptionsModel := new(vpcv1.GetDedicatedHostProfileOptions) - getDedicatedHostProfileOptionsModel.Name = core.StringPtr("testString") - getDedicatedHostProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreateDedicatedHostGroupOptions model + createDedicatedHostGroupOptionsModel := new(vpcv1.CreateDedicatedHostGroupOptions) + createDedicatedHostGroupOptionsModel.Class = core.StringPtr("mx2") + createDedicatedHostGroupOptionsModel.Family = core.StringPtr("balanced") + createDedicatedHostGroupOptionsModel.Zone = zoneIdentityModel + createDedicatedHostGroupOptionsModel.Name = core.StringPtr("testString") + createDedicatedHostGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel + createDedicatedHostGroupOptionsModel.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.GetDedicatedHostProfileWithContext(ctx, getDedicatedHostProfileOptionsModel) + _, _, operationErr := vpcService.CreateDedicatedHostGroupWithContext(ctx, createDedicatedHostGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetDedicatedHostProfile(getDedicatedHostProfileOptionsModel) + result, response, operationErr := vpcService.CreateDedicatedHostGroup(createDedicatedHostGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -35274,7 +35736,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetDedicatedHostProfileWithContext(ctx, getDedicatedHostProfileOptionsModel) + _, _, operationErr = vpcService.CreateDedicatedHostGroupWithContext(ctx, createDedicatedHostGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -35288,18 +35750,34 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getDedicatedHostProfilePath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createDedicatedHostGroupPath)) + 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(200) - fmt.Fprintf(res, "%s", `{"class": "mx2", "disks": [{"interface_type": {"type": "fixed", "value": "nvme"}, "quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 3200}, "supported_instance_interface_types": {"type": "fixed", "value": ["nvme"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": {"type": "fixed", "value": 16}, "name": "mx2-host-152x1216", "socket_count": {"type": "fixed", "value": 2}, "status": "current", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "vcpu_architecture": {"type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"type": "fixed", "value": "intel"}}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"class": "mx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke GetDedicatedHostProfile successfully`, func() { + It(`Invoke CreateDedicatedHostGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -35309,24 +35787,36 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetDedicatedHostProfile(nil) + result, response, operationErr := vpcService.CreateDedicatedHostGroup(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetDedicatedHostProfileOptions model - getDedicatedHostProfileOptionsModel := new(vpcv1.GetDedicatedHostProfileOptions) - getDedicatedHostProfileOptionsModel.Name = core.StringPtr("testString") - getDedicatedHostProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreateDedicatedHostGroupOptions model + createDedicatedHostGroupOptionsModel := new(vpcv1.CreateDedicatedHostGroupOptions) + createDedicatedHostGroupOptionsModel.Class = core.StringPtr("mx2") + createDedicatedHostGroupOptionsModel.Family = core.StringPtr("balanced") + createDedicatedHostGroupOptionsModel.Zone = zoneIdentityModel + createDedicatedHostGroupOptionsModel.Name = core.StringPtr("testString") + createDedicatedHostGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel + createDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetDedicatedHostProfile(getDedicatedHostProfileOptionsModel) + result, response, operationErr = vpcService.CreateDedicatedHostGroup(createDedicatedHostGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetDedicatedHostProfile with error: Operation validation and request error`, func() { + It(`Invoke CreateDedicatedHostGroup with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -35335,22 +35825,34 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetDedicatedHostProfileOptions model - getDedicatedHostProfileOptionsModel := new(vpcv1.GetDedicatedHostProfileOptions) - getDedicatedHostProfileOptionsModel.Name = core.StringPtr("testString") - getDedicatedHostProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreateDedicatedHostGroupOptions model + createDedicatedHostGroupOptionsModel := new(vpcv1.CreateDedicatedHostGroupOptions) + createDedicatedHostGroupOptionsModel.Class = core.StringPtr("mx2") + createDedicatedHostGroupOptionsModel.Family = core.StringPtr("balanced") + createDedicatedHostGroupOptionsModel.Zone = zoneIdentityModel + createDedicatedHostGroupOptionsModel.Name = core.StringPtr("testString") + createDedicatedHostGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel + createDedicatedHostGroupOptionsModel.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.GetDedicatedHostProfile(getDedicatedHostProfileOptionsModel) + result, response, operationErr := vpcService.CreateDedicatedHostGroup(createDedicatedHostGroupOptionsModel) 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 GetDedicatedHostProfileOptions model with no property values - getDedicatedHostProfileOptionsModelNew := new(vpcv1.GetDedicatedHostProfileOptions) + // Construct a second instance of the CreateDedicatedHostGroupOptions model with no property values + createDedicatedHostGroupOptionsModelNew := new(vpcv1.CreateDedicatedHostGroupOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetDedicatedHostProfile(getDedicatedHostProfileOptionsModelNew) + result, response, operationErr = vpcService.CreateDedicatedHostGroup(createDedicatedHostGroupOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -35365,10 +35867,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke GetDedicatedHostProfile successfully`, func() { + It(`Invoke CreateDedicatedHostGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -35377,13 +35879,25 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetDedicatedHostProfileOptions model - getDedicatedHostProfileOptionsModel := new(vpcv1.GetDedicatedHostProfileOptions) - getDedicatedHostProfileOptionsModel.Name = core.StringPtr("testString") - getDedicatedHostProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreateDedicatedHostGroupOptions model + createDedicatedHostGroupOptionsModel := new(vpcv1.CreateDedicatedHostGroupOptions) + createDedicatedHostGroupOptionsModel.Class = core.StringPtr("mx2") + createDedicatedHostGroupOptionsModel.Family = core.StringPtr("balanced") + createDedicatedHostGroupOptionsModel.Zone = zoneIdentityModel + createDedicatedHostGroupOptionsModel.Name = core.StringPtr("testString") + createDedicatedHostGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel + createDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetDedicatedHostProfile(getDedicatedHostProfileOptionsModel) + result, response, operationErr := vpcService.CreateDedicatedHostGroup(createDedicatedHostGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -35395,31 +35909,24 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListDedicatedHosts(listDedicatedHostsOptions *ListDedicatedHostsOptions) - Operation response error`, func() { + Describe(`DeleteDedicatedHostGroup(deleteDedicatedHostGroupOptions *DeleteDedicatedHostGroupOptions)`, func() { version := "testString" - listDedicatedHostsPath := "/dedicated_hosts" - Context(`Using mock server endpoint with invalid JSON response`, func() { + deleteDedicatedHostGroupPath := "/dedicated_host/groups/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(listDedicatedHostsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deleteDedicatedHostGroupPath)) + 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))})) - Expect(req.URL.Query()["dedicated_host_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"us-south-1"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprint(res, `} this is not valid json {`) + res.WriteHeader(204) })) }) - It(`Invoke ListDedicatedHosts with error: Operation response processing error`, func() { + It(`Invoke DeleteDedicatedHostGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -35428,63 +35935,126 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListDedicatedHostsOptions model - listDedicatedHostsOptionsModel := new(vpcv1.ListDedicatedHostsOptions) - listDedicatedHostsOptionsModel.DedicatedHostGroupID = core.StringPtr("testString") - listDedicatedHostsOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listDedicatedHostsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listDedicatedHostsOptionsModel.ZoneName = core.StringPtr("us-south-1") - listDedicatedHostsOptionsModel.Name = core.StringPtr("testString") - listDedicatedHostsOptionsModel.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.ListDedicatedHosts(listDedicatedHostsOptionsModel) - Expect(operationErr).ToNot(BeNil()) + // Invoke operation with nil options model (negative test) + response, operationErr := vpcService.DeleteDedicatedHostGroup(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteDedicatedHostGroupOptions model + deleteDedicatedHostGroupOptionsModel := new(vpcv1.DeleteDedicatedHostGroupOptions) + deleteDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") + deleteDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteDedicatedHostGroup(deleteDedicatedHostGroupOptionsModel) + Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) + }) + It(`Invoke DeleteDedicatedHostGroup 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()) - // Enable retries and test again - vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ListDedicatedHosts(listDedicatedHostsOptionsModel) + // Construct an instance of the DeleteDedicatedHostGroupOptions model + deleteDedicatedHostGroupOptionsModel := new(vpcv1.DeleteDedicatedHostGroupOptions) + deleteDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") + deleteDedicatedHostGroupOptionsModel.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.DeleteDedicatedHostGroup(deleteDedicatedHostGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteDedicatedHostGroupOptions model with no property values + deleteDedicatedHostGroupOptionsModelNew := new(vpcv1.DeleteDedicatedHostGroupOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteDedicatedHostGroup(deleteDedicatedHostGroupOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`ListDedicatedHosts(listDedicatedHostsOptions *ListDedicatedHostsOptions)`, func() { + Describe(`GetDedicatedHostGroup(getDedicatedHostGroupOptions *GetDedicatedHostGroupOptions) - Operation response error`, func() { version := "testString" - listDedicatedHostsPath := "/dedicated_hosts" + getDedicatedHostGroupPath := "/dedicated_host/groups/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(getDedicatedHostGroupPath)) + 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 GetDedicatedHostGroup 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 GetDedicatedHostGroupOptions model + getDedicatedHostGroupOptionsModel := new(vpcv1.GetDedicatedHostGroupOptions) + getDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") + getDedicatedHostGroupOptionsModel.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.GetDedicatedHostGroup(getDedicatedHostGroupOptionsModel) + 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.GetDedicatedHostGroup(getDedicatedHostGroupOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetDedicatedHostGroup(getDedicatedHostGroupOptions *GetDedicatedHostGroupOptions)`, func() { + version := "testString" + getDedicatedHostGroupPath := "/dedicated_host/groups/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(listDedicatedHostsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getDedicatedHostGroupPath)) 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()["dedicated_host_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"us-south-1"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) // 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", `{"dedicated_hosts": [{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"class": "mx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke ListDedicatedHosts successfully with retries`, func() { + It(`Invoke GetDedicatedHostGroup successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -35494,26 +36064,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListDedicatedHostsOptions model - listDedicatedHostsOptionsModel := new(vpcv1.ListDedicatedHostsOptions) - listDedicatedHostsOptionsModel.DedicatedHostGroupID = core.StringPtr("testString") - listDedicatedHostsOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listDedicatedHostsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listDedicatedHostsOptionsModel.ZoneName = core.StringPtr("us-south-1") - listDedicatedHostsOptionsModel.Name = core.StringPtr("testString") - listDedicatedHostsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetDedicatedHostGroupOptions model + getDedicatedHostGroupOptionsModel := new(vpcv1.GetDedicatedHostGroupOptions) + getDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") + getDedicatedHostGroupOptionsModel.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.ListDedicatedHostsWithContext(ctx, listDedicatedHostsOptionsModel) + _, _, operationErr := vpcService.GetDedicatedHostGroupWithContext(ctx, getDedicatedHostGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListDedicatedHosts(listDedicatedHostsOptionsModel) + result, response, operationErr := vpcService.GetDedicatedHostGroup(getDedicatedHostGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -35521,7 +36086,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListDedicatedHostsWithContext(ctx, listDedicatedHostsOptionsModel) + _, _, operationErr = vpcService.GetDedicatedHostGroupWithContext(ctx, getDedicatedHostGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -35535,24 +36100,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getDedicatedHostGroupPath)) 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()["dedicated_host_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"us-south-1"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"dedicated_hosts": [{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"class": "mx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke ListDedicatedHosts successfully`, func() { + It(`Invoke GetDedicatedHostGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -35562,29 +36121,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListDedicatedHosts(nil) + result, response, operationErr := vpcService.GetDedicatedHostGroup(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListDedicatedHostsOptions model - listDedicatedHostsOptionsModel := new(vpcv1.ListDedicatedHostsOptions) - listDedicatedHostsOptionsModel.DedicatedHostGroupID = core.StringPtr("testString") - listDedicatedHostsOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listDedicatedHostsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listDedicatedHostsOptionsModel.ZoneName = core.StringPtr("us-south-1") - listDedicatedHostsOptionsModel.Name = core.StringPtr("testString") - listDedicatedHostsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetDedicatedHostGroupOptions model + getDedicatedHostGroupOptionsModel := new(vpcv1.GetDedicatedHostGroupOptions) + getDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") + getDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListDedicatedHosts(listDedicatedHostsOptionsModel) + result, response, operationErr = vpcService.GetDedicatedHostGroup(getDedicatedHostGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListDedicatedHosts with error: Operation request error`, func() { + It(`Invoke GetDedicatedHostGroup with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -35593,23 +36147,25 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListDedicatedHostsOptions model - listDedicatedHostsOptionsModel := new(vpcv1.ListDedicatedHostsOptions) - listDedicatedHostsOptionsModel.DedicatedHostGroupID = core.StringPtr("testString") - listDedicatedHostsOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listDedicatedHostsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listDedicatedHostsOptionsModel.ZoneName = core.StringPtr("us-south-1") - listDedicatedHostsOptionsModel.Name = core.StringPtr("testString") - listDedicatedHostsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetDedicatedHostGroupOptions model + getDedicatedHostGroupOptionsModel := new(vpcv1.GetDedicatedHostGroupOptions) + getDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") + getDedicatedHostGroupOptionsModel.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.ListDedicatedHosts(listDedicatedHostsOptionsModel) + result, response, operationErr := vpcService.GetDedicatedHostGroup(getDedicatedHostGroupOptionsModel) 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 GetDedicatedHostGroupOptions model with no property values + getDedicatedHostGroupOptionsModelNew := new(vpcv1.GetDedicatedHostGroupOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetDedicatedHostGroup(getDedicatedHostGroupOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -35624,7 +36180,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListDedicatedHosts successfully`, func() { + It(`Invoke GetDedicatedHostGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -35633,18 +36189,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListDedicatedHostsOptions model - listDedicatedHostsOptionsModel := new(vpcv1.ListDedicatedHostsOptions) - listDedicatedHostsOptionsModel.DedicatedHostGroupID = core.StringPtr("testString") - listDedicatedHostsOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listDedicatedHostsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listDedicatedHostsOptionsModel.ZoneName = core.StringPtr("us-south-1") - listDedicatedHostsOptionsModel.Name = core.StringPtr("testString") - listDedicatedHostsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetDedicatedHostGroupOptions model + getDedicatedHostGroupOptionsModel := new(vpcv1.GetDedicatedHostGroupOptions) + getDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") + getDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListDedicatedHosts(listDedicatedHostsOptionsModel) + result, response, operationErr := vpcService.GetDedicatedHostGroup(getDedicatedHostGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -35655,135 +36206,26 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) - Context(`Test pagination helper method on response`, func() { - It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.DedicatedHostCollection) - nextObject := new(vpcv1.DedicatedHostCollectionNext) - 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.DedicatedHostCollection) - - 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.DedicatedHostCollection) - nextObject := new(vpcv1.DedicatedHostCollectionNext) - nextObject.Href = core.StringPtr("ibm.com") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - }) - Context(`Using mock server endpoint - paginated response`, func() { - BeforeEach(func() { - var requestNumber int = 0 - 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(listDedicatedHostsPath)) - Expect(req.Method).To(Equal("GET")) - - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - requestNumber++ - if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"dedicated_hosts":[{"available_memory":128,"available_vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a","disks":[{"available":9,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","instance_disks":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-instance-disk","resource_type":"instance_disk"}],"interface_type":"nvme","lifecycle_state":"stable","name":"my-dedicated-host-disk","provisionable":false,"resource_type":"dedicated_host_disk","size":4,"supported_instance_interface_types":["nvme"]}],"group":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-host-group","resource_type":"dedicated_host_group"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","instance_placement_enabled":true,"instances":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance"}],"lifecycle_state":"stable","memory":128,"name":"my-host","numa":{"count":2,"nodes":[{"available_vcpu":24,"vcpu":56}]},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a","name":"mx2-host-152x1216"},"provisionable":false,"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"dedicated_host","socket_count":4,"state":"available","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16"}],"vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"dedicated_hosts":[{"available_memory":128,"available_vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a","disks":[{"available":9,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","instance_disks":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-instance-disk","resource_type":"instance_disk"}],"interface_type":"nvme","lifecycle_state":"stable","name":"my-dedicated-host-disk","provisionable":false,"resource_type":"dedicated_host_disk","size":4,"supported_instance_interface_types":["nvme"]}],"group":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-host-group","resource_type":"dedicated_host_group"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","instance_placement_enabled":true,"instances":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance"}],"lifecycle_state":"stable","memory":128,"name":"my-host","numa":{"count":2,"nodes":[{"available_vcpu":24,"vcpu":56}]},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a","name":"mx2-host-152x1216"},"provisionable":false,"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"dedicated_host","socket_count":4,"state":"available","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16"}],"vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}`) - } else { - res.WriteHeader(400) - } - })) - }) - It(`Use DedicatedHostsPager.GetNext 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()) - - listDedicatedHostsOptionsModel := &vpcv1.ListDedicatedHostsOptions{ - DedicatedHostGroupID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - ZoneName: core.StringPtr("us-south-1"), - Name: core.StringPtr("testString"), - } - - pager, err := vpcService.NewDedicatedHostsPager(listDedicatedHostsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.DedicatedHost - for pager.HasNext() { - nextPage, err := pager.GetNext() - Expect(err).To(BeNil()) - Expect(nextPage).ToNot(BeNil()) - allResults = append(allResults, nextPage...) - } - Expect(len(allResults)).To(Equal(2)) - }) - It(`Use DedicatedHostsPager.GetAll 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()) - - listDedicatedHostsOptionsModel := &vpcv1.ListDedicatedHostsOptions{ - DedicatedHostGroupID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - ZoneName: core.StringPtr("us-south-1"), - Name: core.StringPtr("testString"), - } - - pager, err := vpcService.NewDedicatedHostsPager(listDedicatedHostsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - allResults, err := pager.GetAll() - Expect(err).To(BeNil()) - Expect(allResults).ToNot(BeNil()) - Expect(len(allResults)).To(Equal(2)) - }) - }) }) - Describe(`CreateDedicatedHost(createDedicatedHostOptions *CreateDedicatedHostOptions) - Operation response error`, func() { + Describe(`UpdateDedicatedHostGroup(updateDedicatedHostGroupOptions *UpdateDedicatedHostGroupOptions) - Operation response error`, func() { version := "testString" - createDedicatedHostPath := "/dedicated_hosts" + updateDedicatedHostGroupPath := "/dedicated_host/groups/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(createDedicatedHostPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(updateDedicatedHostGroupPath)) + 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(201) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateDedicatedHost with error: Operation response processing error`, func() { + It(`Invoke UpdateDedicatedHostGroup with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -35792,39 +36234,26 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DedicatedHostProfileIdentityByName model - dedicatedHostProfileIdentityModel := new(vpcv1.DedicatedHostProfileIdentityByName) - dedicatedHostProfileIdentityModel.Name = core.StringPtr("m-62x496") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the DedicatedHostGroupIdentityByID model - dedicatedHostGroupIdentityModel := new(vpcv1.DedicatedHostGroupIdentityByID) - dedicatedHostGroupIdentityModel.ID = core.StringPtr("0c8eccb4-271c-4518-956c-32bfce5cf83b") - - // Construct an instance of the DedicatedHostPrototypeDedicatedHostByGroup model - dedicatedHostPrototypeModel := new(vpcv1.DedicatedHostPrototypeDedicatedHostByGroup) - dedicatedHostPrototypeModel.InstancePlacementEnabled = core.BoolPtr(true) - dedicatedHostPrototypeModel.Name = core.StringPtr("my-host") - dedicatedHostPrototypeModel.Profile = dedicatedHostProfileIdentityModel - dedicatedHostPrototypeModel.ResourceGroup = resourceGroupIdentityModel - dedicatedHostPrototypeModel.Group = dedicatedHostGroupIdentityModel + // Construct an instance of the DedicatedHostGroupPatch model + dedicatedHostGroupPatchModel := new(vpcv1.DedicatedHostGroupPatch) + dedicatedHostGroupPatchModel.Name = core.StringPtr("my-host-group-updated") + dedicatedHostGroupPatchModelAsPatch, asPatchErr := dedicatedHostGroupPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) - // Construct an instance of the CreateDedicatedHostOptions model - createDedicatedHostOptionsModel := new(vpcv1.CreateDedicatedHostOptions) - createDedicatedHostOptionsModel.DedicatedHostPrototype = dedicatedHostPrototypeModel - createDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateDedicatedHostGroupOptions model + updateDedicatedHostGroupOptionsModel := new(vpcv1.UpdateDedicatedHostGroupOptions) + updateDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") + updateDedicatedHostGroupOptionsModel.DedicatedHostGroupPatch = dedicatedHostGroupPatchModelAsPatch + updateDedicatedHostGroupOptionsModel.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.CreateDedicatedHost(createDedicatedHostOptionsModel) + result, response, operationErr := vpcService.UpdateDedicatedHostGroup(updateDedicatedHostGroupOptionsModel) 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.CreateDedicatedHost(createDedicatedHostOptionsModel) + result, response, operationErr = vpcService.UpdateDedicatedHostGroup(updateDedicatedHostGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -35834,17 +36263,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateDedicatedHost(createDedicatedHostOptions *CreateDedicatedHostOptions)`, func() { + Describe(`UpdateDedicatedHostGroup(updateDedicatedHostGroupOptions *UpdateDedicatedHostGroupOptions)`, func() { version := "testString" - createDedicatedHostPath := "/dedicated_hosts" + updateDedicatedHostGroupPath := "/dedicated_host/groups/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(createDedicatedHostPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(updateDedicatedHostGroupPath)) + Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -35869,11 +36298,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"class": "mx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke CreateDedicatedHost successfully with retries`, func() { + It(`Invoke UpdateDedicatedHostGroup successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -35883,41 +36312,28 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the DedicatedHostProfileIdentityByName model - dedicatedHostProfileIdentityModel := new(vpcv1.DedicatedHostProfileIdentityByName) - dedicatedHostProfileIdentityModel.Name = core.StringPtr("m-62x496") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the DedicatedHostGroupIdentityByID model - dedicatedHostGroupIdentityModel := new(vpcv1.DedicatedHostGroupIdentityByID) - dedicatedHostGroupIdentityModel.ID = core.StringPtr("0c8eccb4-271c-4518-956c-32bfce5cf83b") - - // Construct an instance of the DedicatedHostPrototypeDedicatedHostByGroup model - dedicatedHostPrototypeModel := new(vpcv1.DedicatedHostPrototypeDedicatedHostByGroup) - dedicatedHostPrototypeModel.InstancePlacementEnabled = core.BoolPtr(true) - dedicatedHostPrototypeModel.Name = core.StringPtr("my-host") - dedicatedHostPrototypeModel.Profile = dedicatedHostProfileIdentityModel - dedicatedHostPrototypeModel.ResourceGroup = resourceGroupIdentityModel - dedicatedHostPrototypeModel.Group = dedicatedHostGroupIdentityModel + // Construct an instance of the DedicatedHostGroupPatch model + dedicatedHostGroupPatchModel := new(vpcv1.DedicatedHostGroupPatch) + dedicatedHostGroupPatchModel.Name = core.StringPtr("my-host-group-updated") + dedicatedHostGroupPatchModelAsPatch, asPatchErr := dedicatedHostGroupPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) - // Construct an instance of the CreateDedicatedHostOptions model - createDedicatedHostOptionsModel := new(vpcv1.CreateDedicatedHostOptions) - createDedicatedHostOptionsModel.DedicatedHostPrototype = dedicatedHostPrototypeModel - createDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateDedicatedHostGroupOptions model + updateDedicatedHostGroupOptionsModel := new(vpcv1.UpdateDedicatedHostGroupOptions) + updateDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") + updateDedicatedHostGroupOptionsModel.DedicatedHostGroupPatch = dedicatedHostGroupPatchModelAsPatch + updateDedicatedHostGroupOptionsModel.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.CreateDedicatedHostWithContext(ctx, createDedicatedHostOptionsModel) + _, _, operationErr := vpcService.UpdateDedicatedHostGroupWithContext(ctx, updateDedicatedHostGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateDedicatedHost(createDedicatedHostOptionsModel) + result, response, operationErr := vpcService.UpdateDedicatedHostGroup(updateDedicatedHostGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -35925,7 +36341,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreateDedicatedHostWithContext(ctx, createDedicatedHostOptionsModel) + _, _, operationErr = vpcService.UpdateDedicatedHostGroupWithContext(ctx, updateDedicatedHostGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -35939,8 +36355,8 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createDedicatedHostPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(updateDedicatedHostGroupPath)) + Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -35962,11 +36378,11 @@ var _ = Describe(`VpcV1`, func() { 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", `{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"class": "mx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-host", "resource_type": "dedicated_host"}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host_group", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke CreateDedicatedHost successfully`, func() { + It(`Invoke UpdateDedicatedHostGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -35976,44 +36392,31 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreateDedicatedHost(nil) + result, response, operationErr := vpcService.UpdateDedicatedHostGroup(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the DedicatedHostProfileIdentityByName model - dedicatedHostProfileIdentityModel := new(vpcv1.DedicatedHostProfileIdentityByName) - dedicatedHostProfileIdentityModel.Name = core.StringPtr("m-62x496") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the DedicatedHostGroupIdentityByID model - dedicatedHostGroupIdentityModel := new(vpcv1.DedicatedHostGroupIdentityByID) - dedicatedHostGroupIdentityModel.ID = core.StringPtr("0c8eccb4-271c-4518-956c-32bfce5cf83b") - - // Construct an instance of the DedicatedHostPrototypeDedicatedHostByGroup model - dedicatedHostPrototypeModel := new(vpcv1.DedicatedHostPrototypeDedicatedHostByGroup) - dedicatedHostPrototypeModel.InstancePlacementEnabled = core.BoolPtr(true) - dedicatedHostPrototypeModel.Name = core.StringPtr("my-host") - dedicatedHostPrototypeModel.Profile = dedicatedHostProfileIdentityModel - dedicatedHostPrototypeModel.ResourceGroup = resourceGroupIdentityModel - dedicatedHostPrototypeModel.Group = dedicatedHostGroupIdentityModel + // Construct an instance of the DedicatedHostGroupPatch model + dedicatedHostGroupPatchModel := new(vpcv1.DedicatedHostGroupPatch) + dedicatedHostGroupPatchModel.Name = core.StringPtr("my-host-group-updated") + dedicatedHostGroupPatchModelAsPatch, asPatchErr := dedicatedHostGroupPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) - // Construct an instance of the CreateDedicatedHostOptions model - createDedicatedHostOptionsModel := new(vpcv1.CreateDedicatedHostOptions) - createDedicatedHostOptionsModel.DedicatedHostPrototype = dedicatedHostPrototypeModel - createDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateDedicatedHostGroupOptions model + updateDedicatedHostGroupOptionsModel := new(vpcv1.UpdateDedicatedHostGroupOptions) + updateDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") + updateDedicatedHostGroupOptionsModel.DedicatedHostGroupPatch = dedicatedHostGroupPatchModelAsPatch + updateDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateDedicatedHost(createDedicatedHostOptionsModel) + result, response, operationErr = vpcService.UpdateDedicatedHostGroup(updateDedicatedHostGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateDedicatedHost with error: Operation validation and request error`, func() { + It(`Invoke UpdateDedicatedHostGroup with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -36022,42 +36425,29 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DedicatedHostProfileIdentityByName model - dedicatedHostProfileIdentityModel := new(vpcv1.DedicatedHostProfileIdentityByName) - dedicatedHostProfileIdentityModel.Name = core.StringPtr("m-62x496") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the DedicatedHostGroupIdentityByID model - dedicatedHostGroupIdentityModel := new(vpcv1.DedicatedHostGroupIdentityByID) - dedicatedHostGroupIdentityModel.ID = core.StringPtr("0c8eccb4-271c-4518-956c-32bfce5cf83b") - - // Construct an instance of the DedicatedHostPrototypeDedicatedHostByGroup model - dedicatedHostPrototypeModel := new(vpcv1.DedicatedHostPrototypeDedicatedHostByGroup) - dedicatedHostPrototypeModel.InstancePlacementEnabled = core.BoolPtr(true) - dedicatedHostPrototypeModel.Name = core.StringPtr("my-host") - dedicatedHostPrototypeModel.Profile = dedicatedHostProfileIdentityModel - dedicatedHostPrototypeModel.ResourceGroup = resourceGroupIdentityModel - dedicatedHostPrototypeModel.Group = dedicatedHostGroupIdentityModel + // Construct an instance of the DedicatedHostGroupPatch model + dedicatedHostGroupPatchModel := new(vpcv1.DedicatedHostGroupPatch) + dedicatedHostGroupPatchModel.Name = core.StringPtr("my-host-group-updated") + dedicatedHostGroupPatchModelAsPatch, asPatchErr := dedicatedHostGroupPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) - // Construct an instance of the CreateDedicatedHostOptions model - createDedicatedHostOptionsModel := new(vpcv1.CreateDedicatedHostOptions) - createDedicatedHostOptionsModel.DedicatedHostPrototype = dedicatedHostPrototypeModel - createDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateDedicatedHostGroupOptions model + updateDedicatedHostGroupOptionsModel := new(vpcv1.UpdateDedicatedHostGroupOptions) + updateDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") + updateDedicatedHostGroupOptionsModel.DedicatedHostGroupPatch = dedicatedHostGroupPatchModelAsPatch + updateDedicatedHostGroupOptionsModel.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.CreateDedicatedHost(createDedicatedHostOptionsModel) + result, response, operationErr := vpcService.UpdateDedicatedHostGroup(updateDedicatedHostGroupOptionsModel) 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 CreateDedicatedHostOptions model with no property values - createDedicatedHostOptionsModelNew := new(vpcv1.CreateDedicatedHostOptions) + // Construct a second instance of the UpdateDedicatedHostGroupOptions model with no property values + updateDedicatedHostGroupOptionsModelNew := new(vpcv1.UpdateDedicatedHostGroupOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateDedicatedHost(createDedicatedHostOptionsModelNew) + result, response, operationErr = vpcService.UpdateDedicatedHostGroup(updateDedicatedHostGroupOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -36072,10 +36462,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke CreateDedicatedHost successfully`, func() { + It(`Invoke UpdateDedicatedHostGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -36084,33 +36474,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DedicatedHostProfileIdentityByName model - dedicatedHostProfileIdentityModel := new(vpcv1.DedicatedHostProfileIdentityByName) - dedicatedHostProfileIdentityModel.Name = core.StringPtr("m-62x496") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the DedicatedHostGroupIdentityByID model - dedicatedHostGroupIdentityModel := new(vpcv1.DedicatedHostGroupIdentityByID) - dedicatedHostGroupIdentityModel.ID = core.StringPtr("0c8eccb4-271c-4518-956c-32bfce5cf83b") - - // Construct an instance of the DedicatedHostPrototypeDedicatedHostByGroup model - dedicatedHostPrototypeModel := new(vpcv1.DedicatedHostPrototypeDedicatedHostByGroup) - dedicatedHostPrototypeModel.InstancePlacementEnabled = core.BoolPtr(true) - dedicatedHostPrototypeModel.Name = core.StringPtr("my-host") - dedicatedHostPrototypeModel.Profile = dedicatedHostProfileIdentityModel - dedicatedHostPrototypeModel.ResourceGroup = resourceGroupIdentityModel - dedicatedHostPrototypeModel.Group = dedicatedHostGroupIdentityModel + // Construct an instance of the DedicatedHostGroupPatch model + dedicatedHostGroupPatchModel := new(vpcv1.DedicatedHostGroupPatch) + dedicatedHostGroupPatchModel.Name = core.StringPtr("my-host-group-updated") + dedicatedHostGroupPatchModelAsPatch, asPatchErr := dedicatedHostGroupPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) - // Construct an instance of the CreateDedicatedHostOptions model - createDedicatedHostOptionsModel := new(vpcv1.CreateDedicatedHostOptions) - createDedicatedHostOptionsModel.DedicatedHostPrototype = dedicatedHostPrototypeModel - createDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateDedicatedHostGroupOptions model + updateDedicatedHostGroupOptionsModel := new(vpcv1.UpdateDedicatedHostGroupOptions) + updateDedicatedHostGroupOptionsModel.ID = core.StringPtr("testString") + updateDedicatedHostGroupOptionsModel.DedicatedHostGroupPatch = dedicatedHostGroupPatchModelAsPatch + updateDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.CreateDedicatedHost(createDedicatedHostOptionsModel) + result, response, operationErr := vpcService.UpdateDedicatedHostGroup(updateDedicatedHostGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -36122,25 +36499,27 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListDedicatedHostDisks(listDedicatedHostDisksOptions *ListDedicatedHostDisksOptions) - Operation response error`, func() { + Describe(`ListDedicatedHostProfiles(listDedicatedHostProfilesOptions *ListDedicatedHostProfilesOptions) - Operation response error`, func() { version := "testString" - listDedicatedHostDisksPath := "/dedicated_hosts/testString/disks" + listDedicatedHostProfilesPath := "/dedicated_host/profiles" 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(listDedicatedHostDisksPath)) + Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostProfilesPath)) 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(10))})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListDedicatedHostDisks with error: Operation response processing error`, func() { + It(`Invoke ListDedicatedHostProfiles with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -36149,19 +36528,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListDedicatedHostDisksOptions model - listDedicatedHostDisksOptionsModel := new(vpcv1.ListDedicatedHostDisksOptions) - listDedicatedHostDisksOptionsModel.DedicatedHostID = core.StringPtr("testString") - listDedicatedHostDisksOptionsModel.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.ListDedicatedHostDisks(listDedicatedHostDisksOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) + // Construct an instance of the ListDedicatedHostProfilesOptions model + listDedicatedHostProfilesOptionsModel := new(vpcv1.ListDedicatedHostProfilesOptions) + listDedicatedHostProfilesOptionsModel.Start = core.StringPtr("testString") + listDedicatedHostProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listDedicatedHostProfilesOptionsModel.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.ListDedicatedHostProfiles(listDedicatedHostProfilesOptionsModel) + 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.ListDedicatedHostDisks(listDedicatedHostDisksOptionsModel) + result, response, operationErr = vpcService.ListDedicatedHostProfiles(listDedicatedHostProfilesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -36171,30 +36551,32 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListDedicatedHostDisks(listDedicatedHostDisksOptions *ListDedicatedHostDisksOptions)`, func() { + Describe(`ListDedicatedHostProfiles(listDedicatedHostProfilesOptions *ListDedicatedHostProfilesOptions)`, func() { version := "testString" - listDedicatedHostDisksPath := "/dedicated_hosts/testString/disks" + listDedicatedHostProfilesPath := "/dedicated_host/profiles" 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(listDedicatedHostDisksPath)) + Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostProfilesPath)) 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(10))})) // 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", `{"disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}]}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/profiles?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/profiles?start=9da91&limit=20"}, "profiles": [{"class": "mx2", "disks": [{"interface_type": {"type": "fixed", "value": "nvme"}, "quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 3200}, "supported_instance_interface_types": {"type": "fixed", "value": ["nvme"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": {"type": "fixed", "value": 16}, "name": "mx2-host-152x1216", "socket_count": {"type": "fixed", "value": 2}, "status": "current", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "vcpu_architecture": {"type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"type": "fixed", "value": "intel"}}], "total_count": 132}`) })) }) - It(`Invoke ListDedicatedHostDisks successfully with retries`, func() { + It(`Invoke ListDedicatedHostProfiles successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -36204,21 +36586,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListDedicatedHostDisksOptions model - listDedicatedHostDisksOptionsModel := new(vpcv1.ListDedicatedHostDisksOptions) - listDedicatedHostDisksOptionsModel.DedicatedHostID = core.StringPtr("testString") - listDedicatedHostDisksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDedicatedHostProfilesOptions model + listDedicatedHostProfilesOptionsModel := new(vpcv1.ListDedicatedHostProfilesOptions) + listDedicatedHostProfilesOptionsModel.Start = core.StringPtr("testString") + listDedicatedHostProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listDedicatedHostProfilesOptionsModel.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.ListDedicatedHostDisksWithContext(ctx, listDedicatedHostDisksOptionsModel) + _, _, operationErr := vpcService.ListDedicatedHostProfilesWithContext(ctx, listDedicatedHostProfilesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListDedicatedHostDisks(listDedicatedHostDisksOptionsModel) + result, response, operationErr := vpcService.ListDedicatedHostProfiles(listDedicatedHostProfilesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -36226,7 +36609,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListDedicatedHostDisksWithContext(ctx, listDedicatedHostDisksOptionsModel) + _, _, operationErr = vpcService.ListDedicatedHostProfilesWithContext(ctx, listDedicatedHostProfilesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -36240,18 +36623,20 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostDisksPath)) + Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostProfilesPath)) 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(10))})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}]}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/profiles?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/profiles?start=9da91&limit=20"}, "profiles": [{"class": "mx2", "disks": [{"interface_type": {"type": "fixed", "value": "nvme"}, "quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 3200}, "supported_instance_interface_types": {"type": "fixed", "value": ["nvme"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": {"type": "fixed", "value": 16}, "name": "mx2-host-152x1216", "socket_count": {"type": "fixed", "value": 2}, "status": "current", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "vcpu_architecture": {"type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"type": "fixed", "value": "intel"}}], "total_count": 132}`) })) }) - It(`Invoke ListDedicatedHostDisks successfully`, func() { + It(`Invoke ListDedicatedHostProfiles successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -36261,24 +36646,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListDedicatedHostDisks(nil) + result, response, operationErr := vpcService.ListDedicatedHostProfiles(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListDedicatedHostDisksOptions model - listDedicatedHostDisksOptionsModel := new(vpcv1.ListDedicatedHostDisksOptions) - listDedicatedHostDisksOptionsModel.DedicatedHostID = core.StringPtr("testString") - listDedicatedHostDisksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDedicatedHostProfilesOptions model + listDedicatedHostProfilesOptionsModel := new(vpcv1.ListDedicatedHostProfilesOptions) + listDedicatedHostProfilesOptionsModel.Start = core.StringPtr("testString") + listDedicatedHostProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listDedicatedHostProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListDedicatedHostDisks(listDedicatedHostDisksOptionsModel) + result, response, operationErr = vpcService.ListDedicatedHostProfiles(listDedicatedHostProfilesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListDedicatedHostDisks with error: Operation validation and request error`, func() { + It(`Invoke ListDedicatedHostProfiles with error: Operation request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -36287,25 +36673,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListDedicatedHostDisksOptions model - listDedicatedHostDisksOptionsModel := new(vpcv1.ListDedicatedHostDisksOptions) - listDedicatedHostDisksOptionsModel.DedicatedHostID = core.StringPtr("testString") - listDedicatedHostDisksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDedicatedHostProfilesOptions model + listDedicatedHostProfilesOptionsModel := new(vpcv1.ListDedicatedHostProfilesOptions) + listDedicatedHostProfilesOptionsModel.Start = core.StringPtr("testString") + listDedicatedHostProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listDedicatedHostProfilesOptionsModel.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.ListDedicatedHostDisks(listDedicatedHostDisksOptionsModel) + result, response, operationErr := vpcService.ListDedicatedHostProfiles(listDedicatedHostProfilesOptionsModel) 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 ListDedicatedHostDisksOptions model with no property values - listDedicatedHostDisksOptionsModelNew := new(vpcv1.ListDedicatedHostDisksOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListDedicatedHostDisks(listDedicatedHostDisksOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -36320,7 +36700,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListDedicatedHostDisks successfully`, func() { + It(`Invoke ListDedicatedHostProfiles successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -36329,13 +36709,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListDedicatedHostDisksOptions model - listDedicatedHostDisksOptionsModel := new(vpcv1.ListDedicatedHostDisksOptions) - listDedicatedHostDisksOptionsModel.DedicatedHostID = core.StringPtr("testString") - listDedicatedHostDisksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDedicatedHostProfilesOptions model + listDedicatedHostProfilesOptionsModel := new(vpcv1.ListDedicatedHostProfilesOptions) + listDedicatedHostProfilesOptionsModel.Start = core.StringPtr("testString") + listDedicatedHostProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listDedicatedHostProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListDedicatedHostDisks(listDedicatedHostDisksOptionsModel) + result, response, operationErr := vpcService.ListDedicatedHostProfiles(listDedicatedHostProfilesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -36346,17 +36727,118 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(vpcv1.DedicatedHostProfileCollection) + nextObject := new(vpcv1.DedicatedHostProfileCollectionNext) + 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.DedicatedHostProfileCollection) + + 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.DedicatedHostProfileCollection) + nextObject := new(vpcv1.DedicatedHostProfileCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { + BeforeEach(func() { + var requestNumber int = 0 + 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(listDedicatedHostProfilesPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"profiles":[{"class":"mx2","disks":[{"interface_type":{"type":"fixed","value":"nvme"},"quantity":{"type":"fixed","value":4},"size":{"type":"fixed","value":3200},"supported_instance_interface_types":{"type":"fixed","value":["nvme"]}}],"family":"balanced","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a","memory":{"type":"fixed","value":16},"name":"mx2-host-152x1216","socket_count":{"type":"fixed","value":2},"status":"current","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16"}],"vcpu_architecture":{"type":"fixed","value":"amd64"},"vcpu_count":{"type":"fixed","value":16},"vcpu_manufacturer":{"type":"fixed","value":"intel"}}]}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"profiles":[{"class":"mx2","disks":[{"interface_type":{"type":"fixed","value":"nvme"},"quantity":{"type":"fixed","value":4},"size":{"type":"fixed","value":3200},"supported_instance_interface_types":{"type":"fixed","value":["nvme"]}}],"family":"balanced","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a","memory":{"type":"fixed","value":16},"name":"mx2-host-152x1216","socket_count":{"type":"fixed","value":2},"status":"current","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16"}],"vcpu_architecture":{"type":"fixed","value":"amd64"},"vcpu_count":{"type":"fixed","value":16},"vcpu_manufacturer":{"type":"fixed","value":"intel"}}]}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use DedicatedHostProfilesPager.GetNext 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()) + + listDedicatedHostProfilesOptionsModel := &vpcv1.ListDedicatedHostProfilesOptions{ + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewDedicatedHostProfilesPager(listDedicatedHostProfilesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.DedicatedHostProfile + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) + }) + It(`Use DedicatedHostProfilesPager.GetAll 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()) + + listDedicatedHostProfilesOptionsModel := &vpcv1.ListDedicatedHostProfilesOptions{ + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewDedicatedHostProfilesPager(listDedicatedHostProfilesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) + }) + }) }) - Describe(`GetDedicatedHostDisk(getDedicatedHostDiskOptions *GetDedicatedHostDiskOptions) - Operation response error`, func() { + Describe(`GetDedicatedHostProfile(getDedicatedHostProfileOptions *GetDedicatedHostProfileOptions) - Operation response error`, func() { version := "testString" - getDedicatedHostDiskPath := "/dedicated_hosts/testString/disks/testString" + getDedicatedHostProfilePath := "/dedicated_host/profiles/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(getDedicatedHostDiskPath)) + Expect(req.URL.EscapedPath()).To(Equal(getDedicatedHostProfilePath)) 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))})) @@ -36365,7 +36847,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetDedicatedHostDisk with error: Operation response processing error`, func() { + It(`Invoke GetDedicatedHostProfile with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -36374,20 +36856,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetDedicatedHostDiskOptions model - getDedicatedHostDiskOptionsModel := new(vpcv1.GetDedicatedHostDiskOptions) - getDedicatedHostDiskOptionsModel.DedicatedHostID = core.StringPtr("testString") - getDedicatedHostDiskOptionsModel.ID = core.StringPtr("testString") - getDedicatedHostDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetDedicatedHostProfileOptions model + getDedicatedHostProfileOptionsModel := new(vpcv1.GetDedicatedHostProfileOptions) + getDedicatedHostProfileOptionsModel.Name = core.StringPtr("testString") + getDedicatedHostProfileOptionsModel.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.GetDedicatedHostDisk(getDedicatedHostDiskOptionsModel) + result, response, operationErr := vpcService.GetDedicatedHostProfile(getDedicatedHostProfileOptionsModel) 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.GetDedicatedHostDisk(getDedicatedHostDiskOptionsModel) + result, response, operationErr = vpcService.GetDedicatedHostProfile(getDedicatedHostProfileOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -36397,16 +36878,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetDedicatedHostDisk(getDedicatedHostDiskOptions *GetDedicatedHostDiskOptions)`, func() { + Describe(`GetDedicatedHostProfile(getDedicatedHostProfileOptions *GetDedicatedHostProfileOptions)`, func() { version := "testString" - getDedicatedHostDiskPath := "/dedicated_hosts/testString/disks/testString" + getDedicatedHostProfilePath := "/dedicated_host/profiles/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(getDedicatedHostDiskPath)) + Expect(req.URL.EscapedPath()).To(Equal(getDedicatedHostProfilePath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -36417,10 +36898,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}`) + fmt.Fprintf(res, "%s", `{"class": "mx2", "disks": [{"interface_type": {"type": "fixed", "value": "nvme"}, "quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 3200}, "supported_instance_interface_types": {"type": "fixed", "value": ["nvme"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": {"type": "fixed", "value": 16}, "name": "mx2-host-152x1216", "socket_count": {"type": "fixed", "value": 2}, "status": "current", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "vcpu_architecture": {"type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"type": "fixed", "value": "intel"}}`) })) }) - It(`Invoke GetDedicatedHostDisk successfully with retries`, func() { + It(`Invoke GetDedicatedHostProfile successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -36430,22 +36911,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetDedicatedHostDiskOptions model - getDedicatedHostDiskOptionsModel := new(vpcv1.GetDedicatedHostDiskOptions) - getDedicatedHostDiskOptionsModel.DedicatedHostID = core.StringPtr("testString") - getDedicatedHostDiskOptionsModel.ID = core.StringPtr("testString") - getDedicatedHostDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetDedicatedHostProfileOptions model + getDedicatedHostProfileOptionsModel := new(vpcv1.GetDedicatedHostProfileOptions) + getDedicatedHostProfileOptionsModel.Name = core.StringPtr("testString") + getDedicatedHostProfileOptionsModel.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.GetDedicatedHostDiskWithContext(ctx, getDedicatedHostDiskOptionsModel) + _, _, operationErr := vpcService.GetDedicatedHostProfileWithContext(ctx, getDedicatedHostProfileOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetDedicatedHostDisk(getDedicatedHostDiskOptionsModel) + result, response, operationErr := vpcService.GetDedicatedHostProfile(getDedicatedHostProfileOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -36453,7 +36933,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetDedicatedHostDiskWithContext(ctx, getDedicatedHostDiskOptionsModel) + _, _, operationErr = vpcService.GetDedicatedHostProfileWithContext(ctx, getDedicatedHostProfileOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -36467,7 +36947,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getDedicatedHostDiskPath)) + Expect(req.URL.EscapedPath()).To(Equal(getDedicatedHostProfilePath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -36475,10 +36955,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}`) + fmt.Fprintf(res, "%s", `{"class": "mx2", "disks": [{"interface_type": {"type": "fixed", "value": "nvme"}, "quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 3200}, "supported_instance_interface_types": {"type": "fixed", "value": ["nvme"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": {"type": "fixed", "value": 16}, "name": "mx2-host-152x1216", "socket_count": {"type": "fixed", "value": 2}, "status": "current", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "vcpu_architecture": {"type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}, "vcpu_manufacturer": {"type": "fixed", "value": "intel"}}`) })) }) - It(`Invoke GetDedicatedHostDisk successfully`, func() { + It(`Invoke GetDedicatedHostProfile successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -36488,25 +36968,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetDedicatedHostDisk(nil) + result, response, operationErr := vpcService.GetDedicatedHostProfile(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetDedicatedHostDiskOptions model - getDedicatedHostDiskOptionsModel := new(vpcv1.GetDedicatedHostDiskOptions) - getDedicatedHostDiskOptionsModel.DedicatedHostID = core.StringPtr("testString") - getDedicatedHostDiskOptionsModel.ID = core.StringPtr("testString") - getDedicatedHostDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetDedicatedHostProfileOptions model + getDedicatedHostProfileOptionsModel := new(vpcv1.GetDedicatedHostProfileOptions) + getDedicatedHostProfileOptionsModel.Name = core.StringPtr("testString") + getDedicatedHostProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetDedicatedHostDisk(getDedicatedHostDiskOptionsModel) + result, response, operationErr = vpcService.GetDedicatedHostProfile(getDedicatedHostProfileOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetDedicatedHostDisk with error: Operation validation and request error`, func() { + It(`Invoke GetDedicatedHostProfile with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -36515,23 +36994,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetDedicatedHostDiskOptions model - getDedicatedHostDiskOptionsModel := new(vpcv1.GetDedicatedHostDiskOptions) - getDedicatedHostDiskOptionsModel.DedicatedHostID = core.StringPtr("testString") - getDedicatedHostDiskOptionsModel.ID = core.StringPtr("testString") - getDedicatedHostDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetDedicatedHostProfileOptions model + getDedicatedHostProfileOptionsModel := new(vpcv1.GetDedicatedHostProfileOptions) + getDedicatedHostProfileOptionsModel.Name = core.StringPtr("testString") + getDedicatedHostProfileOptionsModel.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.GetDedicatedHostDisk(getDedicatedHostDiskOptionsModel) + result, response, operationErr := vpcService.GetDedicatedHostProfile(getDedicatedHostProfileOptionsModel) 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 GetDedicatedHostDiskOptions model with no property values - getDedicatedHostDiskOptionsModelNew := new(vpcv1.GetDedicatedHostDiskOptions) + // Construct a second instance of the GetDedicatedHostProfileOptions model with no property values + getDedicatedHostProfileOptionsModelNew := new(vpcv1.GetDedicatedHostProfileOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetDedicatedHostDisk(getDedicatedHostDiskOptionsModelNew) + result, response, operationErr = vpcService.GetDedicatedHostProfile(getDedicatedHostProfileOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -36549,7 +37027,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetDedicatedHostDisk successfully`, func() { + It(`Invoke GetDedicatedHostProfile successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -36558,14 +37036,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetDedicatedHostDiskOptions model - getDedicatedHostDiskOptionsModel := new(vpcv1.GetDedicatedHostDiskOptions) - getDedicatedHostDiskOptionsModel.DedicatedHostID = core.StringPtr("testString") - getDedicatedHostDiskOptionsModel.ID = core.StringPtr("testString") - getDedicatedHostDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetDedicatedHostProfileOptions model + getDedicatedHostProfileOptionsModel := new(vpcv1.GetDedicatedHostProfileOptions) + getDedicatedHostProfileOptionsModel.Name = core.StringPtr("testString") + getDedicatedHostProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetDedicatedHostDisk(getDedicatedHostDiskOptionsModel) + result, response, operationErr := vpcService.GetDedicatedHostProfile(getDedicatedHostProfileOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -36577,25 +37054,31 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateDedicatedHostDisk(updateDedicatedHostDiskOptions *UpdateDedicatedHostDiskOptions) - Operation response error`, func() { + Describe(`ListDedicatedHosts(listDedicatedHostsOptions *ListDedicatedHostsOptions) - Operation response error`, func() { version := "testString" - updateDedicatedHostDiskPath := "/dedicated_hosts/testString/disks/testString" + listDedicatedHostsPath := "/dedicated_hosts" 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(updateDedicatedHostDiskPath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostsPath)) + 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()["dedicated_host_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"us-south-1"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateDedicatedHostDisk with error: Operation response processing error`, func() { + It(`Invoke ListDedicatedHosts with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -36604,27 +37087,24 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DedicatedHostDiskPatch model - dedicatedHostDiskPatchModel := new(vpcv1.DedicatedHostDiskPatch) - dedicatedHostDiskPatchModel.Name = core.StringPtr("my-disk-updated") - dedicatedHostDiskPatchModelAsPatch, asPatchErr := dedicatedHostDiskPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateDedicatedHostDiskOptions model - updateDedicatedHostDiskOptionsModel := new(vpcv1.UpdateDedicatedHostDiskOptions) - updateDedicatedHostDiskOptionsModel.DedicatedHostID = core.StringPtr("testString") - updateDedicatedHostDiskOptionsModel.ID = core.StringPtr("testString") - updateDedicatedHostDiskOptionsModel.DedicatedHostDiskPatch = dedicatedHostDiskPatchModelAsPatch - updateDedicatedHostDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDedicatedHostsOptions model + listDedicatedHostsOptionsModel := new(vpcv1.ListDedicatedHostsOptions) + listDedicatedHostsOptionsModel.DedicatedHostGroupID = core.StringPtr("testString") + listDedicatedHostsOptionsModel.Start = core.StringPtr("testString") + listDedicatedHostsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listDedicatedHostsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listDedicatedHostsOptionsModel.ZoneName = core.StringPtr("us-south-1") + listDedicatedHostsOptionsModel.Name = core.StringPtr("testString") + listDedicatedHostsOptionsModel.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.UpdateDedicatedHostDisk(updateDedicatedHostDiskOptionsModel) + result, response, operationErr := vpcService.ListDedicatedHosts(listDedicatedHostsOptionsModel) 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.UpdateDedicatedHostDisk(updateDedicatedHostDiskOptionsModel) + result, response, operationErr = vpcService.ListDedicatedHosts(listDedicatedHostsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -36634,46 +37114,36 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateDedicatedHostDisk(updateDedicatedHostDiskOptions *UpdateDedicatedHostDiskOptions)`, func() { + Describe(`ListDedicatedHosts(listDedicatedHostsOptions *ListDedicatedHostsOptions)`, func() { version := "testString" - updateDedicatedHostDiskPath := "/dedicated_hosts/testString/disks/testString" + listDedicatedHostsPath := "/dedicated_hosts" 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(updateDedicatedHostDiskPath)) - 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.EscapedPath()).To(Equal(listDedicatedHostsPath)) + 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()["dedicated_host_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"us-south-1"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) // 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", `{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}`) + fmt.Fprintf(res, "%s", `{"dedicated_hosts": [{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) })) }) - It(`Invoke UpdateDedicatedHostDisk successfully with retries`, func() { + It(`Invoke ListDedicatedHosts successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -36683,29 +37153,26 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the DedicatedHostDiskPatch model - dedicatedHostDiskPatchModel := new(vpcv1.DedicatedHostDiskPatch) - dedicatedHostDiskPatchModel.Name = core.StringPtr("my-disk-updated") - dedicatedHostDiskPatchModelAsPatch, asPatchErr := dedicatedHostDiskPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateDedicatedHostDiskOptions model - updateDedicatedHostDiskOptionsModel := new(vpcv1.UpdateDedicatedHostDiskOptions) - updateDedicatedHostDiskOptionsModel.DedicatedHostID = core.StringPtr("testString") - updateDedicatedHostDiskOptionsModel.ID = core.StringPtr("testString") - updateDedicatedHostDiskOptionsModel.DedicatedHostDiskPatch = dedicatedHostDiskPatchModelAsPatch - updateDedicatedHostDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDedicatedHostsOptions model + listDedicatedHostsOptionsModel := new(vpcv1.ListDedicatedHostsOptions) + listDedicatedHostsOptionsModel.DedicatedHostGroupID = core.StringPtr("testString") + listDedicatedHostsOptionsModel.Start = core.StringPtr("testString") + listDedicatedHostsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listDedicatedHostsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listDedicatedHostsOptionsModel.ZoneName = core.StringPtr("us-south-1") + listDedicatedHostsOptionsModel.Name = core.StringPtr("testString") + listDedicatedHostsOptionsModel.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.UpdateDedicatedHostDiskWithContext(ctx, updateDedicatedHostDiskOptionsModel) + _, _, operationErr := vpcService.ListDedicatedHostsWithContext(ctx, listDedicatedHostsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateDedicatedHostDisk(updateDedicatedHostDiskOptionsModel) + result, response, operationErr := vpcService.ListDedicatedHosts(listDedicatedHostsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -36713,7 +37180,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateDedicatedHostDiskWithContext(ctx, updateDedicatedHostDiskOptionsModel) + _, _, operationErr = vpcService.ListDedicatedHostsWithContext(ctx, listDedicatedHostsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -36727,34 +37194,24 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateDedicatedHostDiskPath)) - 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.EscapedPath()).To(Equal(listDedicatedHostsPath)) + 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()["dedicated_host_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"us-south-1"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}`) + fmt.Fprintf(res, "%s", `{"dedicated_hosts": [{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) })) }) - It(`Invoke UpdateDedicatedHostDisk successfully`, func() { + It(`Invoke ListDedicatedHosts successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -36764,32 +37221,29 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateDedicatedHostDisk(nil) + result, response, operationErr := vpcService.ListDedicatedHosts(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the DedicatedHostDiskPatch model - dedicatedHostDiskPatchModel := new(vpcv1.DedicatedHostDiskPatch) - dedicatedHostDiskPatchModel.Name = core.StringPtr("my-disk-updated") - dedicatedHostDiskPatchModelAsPatch, asPatchErr := dedicatedHostDiskPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateDedicatedHostDiskOptions model - updateDedicatedHostDiskOptionsModel := new(vpcv1.UpdateDedicatedHostDiskOptions) - updateDedicatedHostDiskOptionsModel.DedicatedHostID = core.StringPtr("testString") - updateDedicatedHostDiskOptionsModel.ID = core.StringPtr("testString") - updateDedicatedHostDiskOptionsModel.DedicatedHostDiskPatch = dedicatedHostDiskPatchModelAsPatch - updateDedicatedHostDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDedicatedHostsOptions model + listDedicatedHostsOptionsModel := new(vpcv1.ListDedicatedHostsOptions) + listDedicatedHostsOptionsModel.DedicatedHostGroupID = core.StringPtr("testString") + listDedicatedHostsOptionsModel.Start = core.StringPtr("testString") + listDedicatedHostsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listDedicatedHostsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listDedicatedHostsOptionsModel.ZoneName = core.StringPtr("us-south-1") + listDedicatedHostsOptionsModel.Name = core.StringPtr("testString") + listDedicatedHostsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateDedicatedHostDisk(updateDedicatedHostDiskOptionsModel) + result, response, operationErr = vpcService.ListDedicatedHosts(listDedicatedHostsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateDedicatedHostDisk with error: Operation validation and request error`, func() { + It(`Invoke ListDedicatedHosts with error: Operation request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -36798,33 +37252,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DedicatedHostDiskPatch model - dedicatedHostDiskPatchModel := new(vpcv1.DedicatedHostDiskPatch) - dedicatedHostDiskPatchModel.Name = core.StringPtr("my-disk-updated") - dedicatedHostDiskPatchModelAsPatch, asPatchErr := dedicatedHostDiskPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateDedicatedHostDiskOptions model - updateDedicatedHostDiskOptionsModel := new(vpcv1.UpdateDedicatedHostDiskOptions) - updateDedicatedHostDiskOptionsModel.DedicatedHostID = core.StringPtr("testString") - updateDedicatedHostDiskOptionsModel.ID = core.StringPtr("testString") - updateDedicatedHostDiskOptionsModel.DedicatedHostDiskPatch = dedicatedHostDiskPatchModelAsPatch - updateDedicatedHostDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDedicatedHostsOptions model + listDedicatedHostsOptionsModel := new(vpcv1.ListDedicatedHostsOptions) + listDedicatedHostsOptionsModel.DedicatedHostGroupID = core.StringPtr("testString") + listDedicatedHostsOptionsModel.Start = core.StringPtr("testString") + listDedicatedHostsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listDedicatedHostsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listDedicatedHostsOptionsModel.ZoneName = core.StringPtr("us-south-1") + listDedicatedHostsOptionsModel.Name = core.StringPtr("testString") + listDedicatedHostsOptionsModel.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.UpdateDedicatedHostDisk(updateDedicatedHostDiskOptionsModel) + result, response, operationErr := vpcService.ListDedicatedHosts(listDedicatedHostsOptionsModel) 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 UpdateDedicatedHostDiskOptions model with no property values - updateDedicatedHostDiskOptionsModelNew := new(vpcv1.UpdateDedicatedHostDiskOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateDedicatedHostDisk(updateDedicatedHostDiskOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -36839,7 +37283,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateDedicatedHostDisk successfully`, func() { + It(`Invoke ListDedicatedHosts successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -36848,21 +37292,18 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DedicatedHostDiskPatch model - dedicatedHostDiskPatchModel := new(vpcv1.DedicatedHostDiskPatch) - dedicatedHostDiskPatchModel.Name = core.StringPtr("my-disk-updated") - dedicatedHostDiskPatchModelAsPatch, asPatchErr := dedicatedHostDiskPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateDedicatedHostDiskOptions model - updateDedicatedHostDiskOptionsModel := new(vpcv1.UpdateDedicatedHostDiskOptions) - updateDedicatedHostDiskOptionsModel.DedicatedHostID = core.StringPtr("testString") - updateDedicatedHostDiskOptionsModel.ID = core.StringPtr("testString") - updateDedicatedHostDiskOptionsModel.DedicatedHostDiskPatch = dedicatedHostDiskPatchModelAsPatch - updateDedicatedHostDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDedicatedHostsOptions model + listDedicatedHostsOptionsModel := new(vpcv1.ListDedicatedHostsOptions) + listDedicatedHostsOptionsModel.DedicatedHostGroupID = core.StringPtr("testString") + listDedicatedHostsOptionsModel.Start = core.StringPtr("testString") + listDedicatedHostsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listDedicatedHostsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listDedicatedHostsOptionsModel.ZoneName = core.StringPtr("us-south-1") + listDedicatedHostsOptionsModel.Name = core.StringPtr("testString") + listDedicatedHostsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.UpdateDedicatedHostDisk(updateDedicatedHostDiskOptionsModel) + result, response, operationErr := vpcService.ListDedicatedHosts(listDedicatedHostsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -36873,25 +37314,59 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) - }) - Describe(`DeleteDedicatedHost(deleteDedicatedHostOptions *DeleteDedicatedHostOptions)`, func() { - version := "testString" - deleteDedicatedHostPath := "/dedicated_hosts/testString" - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(vpcv1.DedicatedHostCollection) + nextObject := new(vpcv1.DedicatedHostCollectionNext) + 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.DedicatedHostCollection) + + 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.DedicatedHostCollection) + nextObject := new(vpcv1.DedicatedHostCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { + BeforeEach(func() { + var requestNumber int = 0 + 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(deleteDedicatedHostPath)) - Expect(req.Method).To(Equal("DELETE")) + Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostsPath)) + 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.WriteHeader(204) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"dedicated_hosts":[{"available_memory":128,"available_vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a","disks":[{"available":9,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","instance_disks":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-instance-disk","resource_type":"instance_disk"}],"interface_type":"nvme","lifecycle_state":"stable","name":"my-dedicated-host-disk","provisionable":false,"resource_type":"dedicated_host_disk","size":4,"supported_instance_interface_types":["nvme"]}],"group":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-host-group","resource_type":"dedicated_host_group"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","instance_placement_enabled":true,"instances":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance"}],"lifecycle_state":"stable","memory":128,"name":"my-host","numa":{"count":2,"nodes":[{"available_vcpu":24,"vcpu":56}]},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a","name":"mx2-host-152x1216"},"provisionable":false,"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"dedicated_host","socket_count":4,"state":"available","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16"}],"vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"dedicated_hosts":[{"available_memory":128,"available_vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a","disks":[{"available":9,"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","instance_disks":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-instance-disk","resource_type":"instance_disk"}],"interface_type":"nvme","lifecycle_state":"stable","name":"my-dedicated-host-disk","provisionable":false,"resource_type":"dedicated_host_disk","size":4,"supported_instance_interface_types":["nvme"]}],"group":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","id":"bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","name":"my-host-group","resource_type":"dedicated_host_group"},"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","instance_placement_enabled":true,"instances":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance"}],"lifecycle_state":"stable","memory":128,"name":"my-host","numa":{"count":2,"nodes":[{"available_vcpu":24,"vcpu":56}]},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a","name":"mx2-host-152x1216"},"provisionable":false,"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"dedicated_host","socket_count":4,"state":"available","supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16"}],"vcpu":{"architecture":"amd64","count":4,"manufacturer":"intel"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}`) + } else { + res.WriteHeader(400) + } })) }) - It(`Invoke DeleteDedicatedHost successfully`, func() { + It(`Use DedicatedHostsPager.GetNext successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -36900,22 +37375,28 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.DeleteDedicatedHost(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) + listDedicatedHostsOptionsModel := &vpcv1.ListDedicatedHostsOptions{ + DedicatedHostGroupID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + ZoneName: core.StringPtr("us-south-1"), + Name: core.StringPtr("testString"), + } - // Construct an instance of the DeleteDedicatedHostOptions model - deleteDedicatedHostOptionsModel := new(vpcv1.DeleteDedicatedHostOptions) - deleteDedicatedHostOptionsModel.ID = core.StringPtr("testString") - deleteDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + pager, err := vpcService.NewDedicatedHostsPager(listDedicatedHostsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteDedicatedHost(deleteDedicatedHostOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) + var allResults []vpcv1.DedicatedHost + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) }) - It(`Invoke DeleteDedicatedHost with error: Operation validation and request error`, func() { + It(`Use DedicatedHostsPager.GetAll successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -36924,48 +37405,44 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteDedicatedHostOptions model - deleteDedicatedHostOptionsModel := new(vpcv1.DeleteDedicatedHostOptions) - deleteDedicatedHostOptionsModel.ID = core.StringPtr("testString") - deleteDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := vpcService.SetServiceURL("") + listDedicatedHostsOptionsModel := &vpcv1.ListDedicatedHostsOptions{ + DedicatedHostGroupID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + ZoneName: core.StringPtr("us-south-1"), + Name: core.StringPtr("testString"), + } + + pager, err := vpcService.NewDedicatedHostsPager(listDedicatedHostsOptionsModel) Expect(err).To(BeNil()) - response, operationErr := vpcService.DeleteDedicatedHost(deleteDedicatedHostOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteDedicatedHostOptions model with no property values - deleteDedicatedHostOptionsModelNew := new(vpcv1.DeleteDedicatedHostOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteDedicatedHost(deleteDedicatedHostOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) }) }) }) - Describe(`GetDedicatedHost(getDedicatedHostOptions *GetDedicatedHostOptions) - Operation response error`, func() { + Describe(`CreateDedicatedHost(createDedicatedHostOptions *CreateDedicatedHostOptions) - Operation response error`, func() { version := "testString" - getDedicatedHostPath := "/dedicated_hosts/testString" + createDedicatedHostPath := "/dedicated_hosts" 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(getDedicatedHostPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createDedicatedHostPath)) + 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(200) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetDedicatedHost with error: Operation response processing error`, func() { + It(`Invoke CreateDedicatedHost with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -36974,19 +37451,39 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetDedicatedHostOptions model - getDedicatedHostOptionsModel := new(vpcv1.GetDedicatedHostOptions) - getDedicatedHostOptionsModel.ID = core.StringPtr("testString") - getDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DedicatedHostProfileIdentityByName model + dedicatedHostProfileIdentityModel := new(vpcv1.DedicatedHostProfileIdentityByName) + dedicatedHostProfileIdentityModel.Name = core.StringPtr("m-62x496") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the DedicatedHostGroupIdentityByID model + dedicatedHostGroupIdentityModel := new(vpcv1.DedicatedHostGroupIdentityByID) + dedicatedHostGroupIdentityModel.ID = core.StringPtr("0c8eccb4-271c-4518-956c-32bfce5cf83b") + + // Construct an instance of the DedicatedHostPrototypeDedicatedHostByGroup model + dedicatedHostPrototypeModel := new(vpcv1.DedicatedHostPrototypeDedicatedHostByGroup) + dedicatedHostPrototypeModel.InstancePlacementEnabled = core.BoolPtr(true) + dedicatedHostPrototypeModel.Name = core.StringPtr("my-host") + dedicatedHostPrototypeModel.Profile = dedicatedHostProfileIdentityModel + dedicatedHostPrototypeModel.ResourceGroup = resourceGroupIdentityModel + dedicatedHostPrototypeModel.Group = dedicatedHostGroupIdentityModel + + // Construct an instance of the CreateDedicatedHostOptions model + createDedicatedHostOptionsModel := new(vpcv1.CreateDedicatedHostOptions) + createDedicatedHostOptionsModel.DedicatedHostPrototype = dedicatedHostPrototypeModel + createDedicatedHostOptionsModel.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.GetDedicatedHost(getDedicatedHostOptionsModel) + result, response, operationErr := vpcService.CreateDedicatedHost(createDedicatedHostOptionsModel) 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.GetDedicatedHost(getDedicatedHostOptionsModel) + result, response, operationErr = vpcService.CreateDedicatedHost(createDedicatedHostOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -36996,17 +37493,33 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetDedicatedHost(getDedicatedHostOptions *GetDedicatedHostOptions)`, func() { + Describe(`CreateDedicatedHost(createDedicatedHostOptions *CreateDedicatedHostOptions)`, func() { version := "testString" - getDedicatedHostPath := "/dedicated_hosts/testString" + createDedicatedHostPath := "/dedicated_hosts" 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(getDedicatedHostPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createDedicatedHostPath)) + 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))})) @@ -37015,11 +37528,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(201) fmt.Fprintf(res, "%s", `{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke GetDedicatedHost successfully with retries`, func() { + It(`Invoke CreateDedicatedHost successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -37029,21 +37542,41 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetDedicatedHostOptions model - getDedicatedHostOptionsModel := new(vpcv1.GetDedicatedHostOptions) - getDedicatedHostOptionsModel.ID = core.StringPtr("testString") - getDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DedicatedHostProfileIdentityByName model + dedicatedHostProfileIdentityModel := new(vpcv1.DedicatedHostProfileIdentityByName) + dedicatedHostProfileIdentityModel.Name = core.StringPtr("m-62x496") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the DedicatedHostGroupIdentityByID model + dedicatedHostGroupIdentityModel := new(vpcv1.DedicatedHostGroupIdentityByID) + dedicatedHostGroupIdentityModel.ID = core.StringPtr("0c8eccb4-271c-4518-956c-32bfce5cf83b") + + // Construct an instance of the DedicatedHostPrototypeDedicatedHostByGroup model + dedicatedHostPrototypeModel := new(vpcv1.DedicatedHostPrototypeDedicatedHostByGroup) + dedicatedHostPrototypeModel.InstancePlacementEnabled = core.BoolPtr(true) + dedicatedHostPrototypeModel.Name = core.StringPtr("my-host") + dedicatedHostPrototypeModel.Profile = dedicatedHostProfileIdentityModel + dedicatedHostPrototypeModel.ResourceGroup = resourceGroupIdentityModel + dedicatedHostPrototypeModel.Group = dedicatedHostGroupIdentityModel + + // Construct an instance of the CreateDedicatedHostOptions model + createDedicatedHostOptionsModel := new(vpcv1.CreateDedicatedHostOptions) + createDedicatedHostOptionsModel.DedicatedHostPrototype = dedicatedHostPrototypeModel + createDedicatedHostOptionsModel.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.GetDedicatedHostWithContext(ctx, getDedicatedHostOptionsModel) + _, _, operationErr := vpcService.CreateDedicatedHostWithContext(ctx, createDedicatedHostOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetDedicatedHost(getDedicatedHostOptionsModel) + result, response, operationErr := vpcService.CreateDedicatedHost(createDedicatedHostOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -37051,7 +37584,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetDedicatedHostWithContext(ctx, getDedicatedHostOptionsModel) + _, _, operationErr = vpcService.CreateDedicatedHostWithContext(ctx, createDedicatedHostOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -37065,18 +37598,34 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getDedicatedHostPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createDedicatedHostPath)) + 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(200) + res.WriteHeader(201) fmt.Fprintf(res, "%s", `{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke GetDedicatedHost successfully`, func() { + It(`Invoke CreateDedicatedHost successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -37086,24 +37635,44 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetDedicatedHost(nil) + result, response, operationErr := vpcService.CreateDedicatedHost(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetDedicatedHostOptions model - getDedicatedHostOptionsModel := new(vpcv1.GetDedicatedHostOptions) - getDedicatedHostOptionsModel.ID = core.StringPtr("testString") - getDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DedicatedHostProfileIdentityByName model + dedicatedHostProfileIdentityModel := new(vpcv1.DedicatedHostProfileIdentityByName) + dedicatedHostProfileIdentityModel.Name = core.StringPtr("m-62x496") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the DedicatedHostGroupIdentityByID model + dedicatedHostGroupIdentityModel := new(vpcv1.DedicatedHostGroupIdentityByID) + dedicatedHostGroupIdentityModel.ID = core.StringPtr("0c8eccb4-271c-4518-956c-32bfce5cf83b") + + // Construct an instance of the DedicatedHostPrototypeDedicatedHostByGroup model + dedicatedHostPrototypeModel := new(vpcv1.DedicatedHostPrototypeDedicatedHostByGroup) + dedicatedHostPrototypeModel.InstancePlacementEnabled = core.BoolPtr(true) + dedicatedHostPrototypeModel.Name = core.StringPtr("my-host") + dedicatedHostPrototypeModel.Profile = dedicatedHostProfileIdentityModel + dedicatedHostPrototypeModel.ResourceGroup = resourceGroupIdentityModel + dedicatedHostPrototypeModel.Group = dedicatedHostGroupIdentityModel + + // Construct an instance of the CreateDedicatedHostOptions model + createDedicatedHostOptionsModel := new(vpcv1.CreateDedicatedHostOptions) + createDedicatedHostOptionsModel.DedicatedHostPrototype = dedicatedHostPrototypeModel + createDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetDedicatedHost(getDedicatedHostOptionsModel) + result, response, operationErr = vpcService.CreateDedicatedHost(createDedicatedHostOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetDedicatedHost with error: Operation validation and request error`, func() { + It(`Invoke CreateDedicatedHost with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -37112,22 +37681,42 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetDedicatedHostOptions model - getDedicatedHostOptionsModel := new(vpcv1.GetDedicatedHostOptions) - getDedicatedHostOptionsModel.ID = core.StringPtr("testString") - getDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DedicatedHostProfileIdentityByName model + dedicatedHostProfileIdentityModel := new(vpcv1.DedicatedHostProfileIdentityByName) + dedicatedHostProfileIdentityModel.Name = core.StringPtr("m-62x496") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the DedicatedHostGroupIdentityByID model + dedicatedHostGroupIdentityModel := new(vpcv1.DedicatedHostGroupIdentityByID) + dedicatedHostGroupIdentityModel.ID = core.StringPtr("0c8eccb4-271c-4518-956c-32bfce5cf83b") + + // Construct an instance of the DedicatedHostPrototypeDedicatedHostByGroup model + dedicatedHostPrototypeModel := new(vpcv1.DedicatedHostPrototypeDedicatedHostByGroup) + dedicatedHostPrototypeModel.InstancePlacementEnabled = core.BoolPtr(true) + dedicatedHostPrototypeModel.Name = core.StringPtr("my-host") + dedicatedHostPrototypeModel.Profile = dedicatedHostProfileIdentityModel + dedicatedHostPrototypeModel.ResourceGroup = resourceGroupIdentityModel + dedicatedHostPrototypeModel.Group = dedicatedHostGroupIdentityModel + + // Construct an instance of the CreateDedicatedHostOptions model + createDedicatedHostOptionsModel := new(vpcv1.CreateDedicatedHostOptions) + createDedicatedHostOptionsModel.DedicatedHostPrototype = dedicatedHostPrototypeModel + createDedicatedHostOptionsModel.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.GetDedicatedHost(getDedicatedHostOptionsModel) + result, response, operationErr := vpcService.CreateDedicatedHost(createDedicatedHostOptionsModel) 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 GetDedicatedHostOptions model with no property values - getDedicatedHostOptionsModelNew := new(vpcv1.GetDedicatedHostOptions) + // Construct a second instance of the CreateDedicatedHostOptions model with no property values + createDedicatedHostOptionsModelNew := new(vpcv1.CreateDedicatedHostOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetDedicatedHost(getDedicatedHostOptionsModelNew) + result, response, operationErr = vpcService.CreateDedicatedHost(createDedicatedHostOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -37142,10 +37731,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke GetDedicatedHost successfully`, func() { + It(`Invoke CreateDedicatedHost successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -37154,13 +37743,33 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetDedicatedHostOptions model - getDedicatedHostOptionsModel := new(vpcv1.GetDedicatedHostOptions) - getDedicatedHostOptionsModel.ID = core.StringPtr("testString") - getDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DedicatedHostProfileIdentityByName model + dedicatedHostProfileIdentityModel := new(vpcv1.DedicatedHostProfileIdentityByName) + dedicatedHostProfileIdentityModel.Name = core.StringPtr("m-62x496") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the DedicatedHostGroupIdentityByID model + dedicatedHostGroupIdentityModel := new(vpcv1.DedicatedHostGroupIdentityByID) + dedicatedHostGroupIdentityModel.ID = core.StringPtr("0c8eccb4-271c-4518-956c-32bfce5cf83b") + + // Construct an instance of the DedicatedHostPrototypeDedicatedHostByGroup model + dedicatedHostPrototypeModel := new(vpcv1.DedicatedHostPrototypeDedicatedHostByGroup) + dedicatedHostPrototypeModel.InstancePlacementEnabled = core.BoolPtr(true) + dedicatedHostPrototypeModel.Name = core.StringPtr("my-host") + dedicatedHostPrototypeModel.Profile = dedicatedHostProfileIdentityModel + dedicatedHostPrototypeModel.ResourceGroup = resourceGroupIdentityModel + dedicatedHostPrototypeModel.Group = dedicatedHostGroupIdentityModel + + // Construct an instance of the CreateDedicatedHostOptions model + createDedicatedHostOptionsModel := new(vpcv1.CreateDedicatedHostOptions) + createDedicatedHostOptionsModel.DedicatedHostPrototype = dedicatedHostPrototypeModel + createDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetDedicatedHost(getDedicatedHostOptionsModel) + result, response, operationErr := vpcService.CreateDedicatedHost(createDedicatedHostOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -37172,17 +37781,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateDedicatedHost(updateDedicatedHostOptions *UpdateDedicatedHostOptions) - Operation response error`, func() { + Describe(`ListDedicatedHostDisks(listDedicatedHostDisksOptions *ListDedicatedHostDisksOptions) - Operation response error`, func() { version := "testString" - updateDedicatedHostPath := "/dedicated_hosts/testString" + listDedicatedHostDisksPath := "/dedicated_hosts/testString/disks" 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(updateDedicatedHostPath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(listDedicatedHostDisksPath)) + 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") @@ -37190,7 +37799,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateDedicatedHost with error: Operation response processing error`, func() { + It(`Invoke ListDedicatedHostDisks with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -37199,27 +37808,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DedicatedHostPatch model - dedicatedHostPatchModel := new(vpcv1.DedicatedHostPatch) - dedicatedHostPatchModel.InstancePlacementEnabled = core.BoolPtr(true) - dedicatedHostPatchModel.Name = core.StringPtr("my-host") - dedicatedHostPatchModelAsPatch, asPatchErr := dedicatedHostPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateDedicatedHostOptions model - updateDedicatedHostOptionsModel := new(vpcv1.UpdateDedicatedHostOptions) - updateDedicatedHostOptionsModel.ID = core.StringPtr("testString") - updateDedicatedHostOptionsModel.DedicatedHostPatch = dedicatedHostPatchModelAsPatch - updateDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDedicatedHostDisksOptions model + listDedicatedHostDisksOptionsModel := new(vpcv1.ListDedicatedHostDisksOptions) + listDedicatedHostDisksOptionsModel.DedicatedHostID = core.StringPtr("testString") + listDedicatedHostDisksOptionsModel.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.UpdateDedicatedHost(updateDedicatedHostOptionsModel) + result, response, operationErr := vpcService.ListDedicatedHostDisks(listDedicatedHostDisksOptionsModel) 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.UpdateDedicatedHost(updateDedicatedHostOptionsModel) + result, response, operationErr = vpcService.ListDedicatedHostDisks(listDedicatedHostDisksOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -37229,33 +37830,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateDedicatedHost(updateDedicatedHostOptions *UpdateDedicatedHostOptions)`, func() { + Describe(`ListDedicatedHostDisks(listDedicatedHostDisksOptions *ListDedicatedHostDisksOptions)`, func() { version := "testString" - updateDedicatedHostPath := "/dedicated_hosts/testString" + listDedicatedHostDisksPath := "/dedicated_hosts/testString/disks" 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(updateDedicatedHostPath)) - 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.EscapedPath()).To(Equal(listDedicatedHostDisksPath)) + 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))})) @@ -37265,10 +37850,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "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", `{"disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}]}`) })) }) - It(`Invoke UpdateDedicatedHost successfully with retries`, func() { + It(`Invoke ListDedicatedHostDisks successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -37278,29 +37863,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the DedicatedHostPatch model - dedicatedHostPatchModel := new(vpcv1.DedicatedHostPatch) - dedicatedHostPatchModel.InstancePlacementEnabled = core.BoolPtr(true) - dedicatedHostPatchModel.Name = core.StringPtr("my-host") - dedicatedHostPatchModelAsPatch, asPatchErr := dedicatedHostPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateDedicatedHostOptions model - updateDedicatedHostOptionsModel := new(vpcv1.UpdateDedicatedHostOptions) - updateDedicatedHostOptionsModel.ID = core.StringPtr("testString") - updateDedicatedHostOptionsModel.DedicatedHostPatch = dedicatedHostPatchModelAsPatch - updateDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDedicatedHostDisksOptions model + listDedicatedHostDisksOptionsModel := new(vpcv1.ListDedicatedHostDisksOptions) + listDedicatedHostDisksOptionsModel.DedicatedHostID = core.StringPtr("testString") + listDedicatedHostDisksOptionsModel.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.UpdateDedicatedHostWithContext(ctx, updateDedicatedHostOptionsModel) + _, _, operationErr := vpcService.ListDedicatedHostDisksWithContext(ctx, listDedicatedHostDisksOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateDedicatedHost(updateDedicatedHostOptionsModel) + result, response, operationErr := vpcService.ListDedicatedHostDisks(listDedicatedHostDisksOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -37308,7 +37885,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateDedicatedHostWithContext(ctx, updateDedicatedHostOptionsModel) + _, _, operationErr = vpcService.ListDedicatedHostDisksWithContext(ctx, listDedicatedHostDisksOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -37322,34 +37899,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateDedicatedHostPath)) - 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.EscapedPath()).To(Equal(listDedicatedHostDisksPath)) + 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", `{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "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", `{"disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}]}`) })) }) - It(`Invoke UpdateDedicatedHost successfully`, func() { + It(`Invoke ListDedicatedHostDisks successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -37359,32 +37920,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateDedicatedHost(nil) + result, response, operationErr := vpcService.ListDedicatedHostDisks(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the DedicatedHostPatch model - dedicatedHostPatchModel := new(vpcv1.DedicatedHostPatch) - dedicatedHostPatchModel.InstancePlacementEnabled = core.BoolPtr(true) - dedicatedHostPatchModel.Name = core.StringPtr("my-host") - dedicatedHostPatchModelAsPatch, asPatchErr := dedicatedHostPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateDedicatedHostOptions model - updateDedicatedHostOptionsModel := new(vpcv1.UpdateDedicatedHostOptions) - updateDedicatedHostOptionsModel.ID = core.StringPtr("testString") - updateDedicatedHostOptionsModel.DedicatedHostPatch = dedicatedHostPatchModelAsPatch - updateDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDedicatedHostDisksOptions model + listDedicatedHostDisksOptionsModel := new(vpcv1.ListDedicatedHostDisksOptions) + listDedicatedHostDisksOptionsModel.DedicatedHostID = core.StringPtr("testString") + listDedicatedHostDisksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateDedicatedHost(updateDedicatedHostOptionsModel) + result, response, operationErr = vpcService.ListDedicatedHostDisks(listDedicatedHostDisksOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateDedicatedHost with error: Operation validation and request error`, func() { + It(`Invoke ListDedicatedHostDisks with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -37393,30 +37946,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DedicatedHostPatch model - dedicatedHostPatchModel := new(vpcv1.DedicatedHostPatch) - dedicatedHostPatchModel.InstancePlacementEnabled = core.BoolPtr(true) - dedicatedHostPatchModel.Name = core.StringPtr("my-host") - dedicatedHostPatchModelAsPatch, asPatchErr := dedicatedHostPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateDedicatedHostOptions model - updateDedicatedHostOptionsModel := new(vpcv1.UpdateDedicatedHostOptions) - updateDedicatedHostOptionsModel.ID = core.StringPtr("testString") - updateDedicatedHostOptionsModel.DedicatedHostPatch = dedicatedHostPatchModelAsPatch - updateDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDedicatedHostDisksOptions model + listDedicatedHostDisksOptionsModel := new(vpcv1.ListDedicatedHostDisksOptions) + listDedicatedHostDisksOptionsModel.DedicatedHostID = core.StringPtr("testString") + listDedicatedHostDisksOptionsModel.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.UpdateDedicatedHost(updateDedicatedHostOptionsModel) + result, response, operationErr := vpcService.ListDedicatedHostDisks(listDedicatedHostDisksOptionsModel) 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 UpdateDedicatedHostOptions model with no property values - updateDedicatedHostOptionsModelNew := new(vpcv1.UpdateDedicatedHostOptions) + // Construct a second instance of the ListDedicatedHostDisksOptions model with no property values + listDedicatedHostDisksOptionsModelNew := new(vpcv1.ListDedicatedHostDisksOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateDedicatedHost(updateDedicatedHostOptionsModelNew) + result, response, operationErr = vpcService.ListDedicatedHostDisks(listDedicatedHostDisksOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -37434,7 +37979,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateDedicatedHost successfully`, func() { + It(`Invoke ListDedicatedHostDisks successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -37443,21 +37988,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DedicatedHostPatch model - dedicatedHostPatchModel := new(vpcv1.DedicatedHostPatch) - dedicatedHostPatchModel.InstancePlacementEnabled = core.BoolPtr(true) - dedicatedHostPatchModel.Name = core.StringPtr("my-host") - dedicatedHostPatchModelAsPatch, asPatchErr := dedicatedHostPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateDedicatedHostOptions model - updateDedicatedHostOptionsModel := new(vpcv1.UpdateDedicatedHostOptions) - updateDedicatedHostOptionsModel.ID = core.StringPtr("testString") - updateDedicatedHostOptionsModel.DedicatedHostPatch = dedicatedHostPatchModelAsPatch - updateDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDedicatedHostDisksOptions model + listDedicatedHostDisksOptionsModel := new(vpcv1.ListDedicatedHostDisksOptions) + listDedicatedHostDisksOptionsModel.DedicatedHostID = core.StringPtr("testString") + listDedicatedHostDisksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.UpdateDedicatedHost(updateDedicatedHostOptionsModel) + result, response, operationErr := vpcService.ListDedicatedHostDisks(listDedicatedHostDisksOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -37469,30 +38006,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListBackupPolicies(listBackupPoliciesOptions *ListBackupPoliciesOptions) - Operation response error`, func() { + Describe(`GetDedicatedHostDisk(getDedicatedHostDiskOptions *GetDedicatedHostDiskOptions) - Operation response error`, func() { version := "testString" - listBackupPoliciesPath := "/backup_policies" + getDedicatedHostDiskPath := "/dedicated_hosts/testString/disks/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(listBackupPoliciesPath)) + Expect(req.URL.EscapedPath()).To(Equal(getDedicatedHostDiskPath)) 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(10))})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["tag"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListBackupPolicies with error: Operation response processing error`, func() { + It(`Invoke GetDedicatedHostDisk with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -37501,23 +38033,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBackupPoliciesOptions model - listBackupPoliciesOptionsModel := new(vpcv1.ListBackupPoliciesOptions) - listBackupPoliciesOptionsModel.Start = core.StringPtr("testString") - listBackupPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBackupPoliciesOptionsModel.ResourceGroupID = core.StringPtr("testString") - listBackupPoliciesOptionsModel.Name = core.StringPtr("testString") - listBackupPoliciesOptionsModel.Tag = core.StringPtr("testString") - listBackupPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetDedicatedHostDiskOptions model + getDedicatedHostDiskOptionsModel := new(vpcv1.GetDedicatedHostDiskOptions) + getDedicatedHostDiskOptionsModel.DedicatedHostID = core.StringPtr("testString") + getDedicatedHostDiskOptionsModel.ID = core.StringPtr("testString") + getDedicatedHostDiskOptionsModel.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.ListBackupPolicies(listBackupPoliciesOptionsModel) + result, response, operationErr := vpcService.GetDedicatedHostDisk(getDedicatedHostDiskOptionsModel) 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.ListBackupPolicies(listBackupPoliciesOptionsModel) + result, response, operationErr = vpcService.GetDedicatedHostDisk(getDedicatedHostDiskOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -37527,35 +38056,30 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListBackupPolicies(listBackupPoliciesOptions *ListBackupPoliciesOptions)`, func() { + Describe(`GetDedicatedHostDisk(getDedicatedHostDiskOptions *GetDedicatedHostDiskOptions)`, func() { version := "testString" - listBackupPoliciesPath := "/backup_policies" + getDedicatedHostDiskPath := "/dedicated_hosts/testString/disks/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(listBackupPoliciesPath)) + Expect(req.URL.EscapedPath()).To(Equal(getDedicatedHostDiskPath)) 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(10))})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["tag"]).To(Equal([]string{"testString"})) // 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", `{"backup_policies": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_user_tags": ["MatchUserTags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/123456::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "fee82deba12e4c0fb69c3b09d1f12345", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}`) })) }) - It(`Invoke ListBackupPolicies successfully with retries`, func() { + It(`Invoke GetDedicatedHostDisk successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -37565,25 +38089,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListBackupPoliciesOptions model - listBackupPoliciesOptionsModel := new(vpcv1.ListBackupPoliciesOptions) - listBackupPoliciesOptionsModel.Start = core.StringPtr("testString") - listBackupPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBackupPoliciesOptionsModel.ResourceGroupID = core.StringPtr("testString") - listBackupPoliciesOptionsModel.Name = core.StringPtr("testString") - listBackupPoliciesOptionsModel.Tag = core.StringPtr("testString") - listBackupPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetDedicatedHostDiskOptions model + getDedicatedHostDiskOptionsModel := new(vpcv1.GetDedicatedHostDiskOptions) + getDedicatedHostDiskOptionsModel.DedicatedHostID = core.StringPtr("testString") + getDedicatedHostDiskOptionsModel.ID = core.StringPtr("testString") + getDedicatedHostDiskOptionsModel.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.ListBackupPoliciesWithContext(ctx, listBackupPoliciesOptionsModel) + _, _, operationErr := vpcService.GetDedicatedHostDiskWithContext(ctx, getDedicatedHostDiskOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListBackupPolicies(listBackupPoliciesOptionsModel) + result, response, operationErr := vpcService.GetDedicatedHostDisk(getDedicatedHostDiskOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -37591,7 +38112,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListBackupPoliciesWithContext(ctx, listBackupPoliciesOptionsModel) + _, _, operationErr = vpcService.GetDedicatedHostDiskWithContext(ctx, getDedicatedHostDiskOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -37605,23 +38126,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBackupPoliciesPath)) + Expect(req.URL.EscapedPath()).To(Equal(getDedicatedHostDiskPath)) 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(10))})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["tag"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"backup_policies": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_user_tags": ["MatchUserTags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/123456::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "fee82deba12e4c0fb69c3b09d1f12345", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}`) })) }) - It(`Invoke ListBackupPolicies successfully`, func() { + It(`Invoke GetDedicatedHostDisk successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -37631,28 +38147,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListBackupPolicies(nil) + result, response, operationErr := vpcService.GetDedicatedHostDisk(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListBackupPoliciesOptions model - listBackupPoliciesOptionsModel := new(vpcv1.ListBackupPoliciesOptions) - listBackupPoliciesOptionsModel.Start = core.StringPtr("testString") - listBackupPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBackupPoliciesOptionsModel.ResourceGroupID = core.StringPtr("testString") - listBackupPoliciesOptionsModel.Name = core.StringPtr("testString") - listBackupPoliciesOptionsModel.Tag = core.StringPtr("testString") - listBackupPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetDedicatedHostDiskOptions model + getDedicatedHostDiskOptionsModel := new(vpcv1.GetDedicatedHostDiskOptions) + getDedicatedHostDiskOptionsModel.DedicatedHostID = core.StringPtr("testString") + getDedicatedHostDiskOptionsModel.ID = core.StringPtr("testString") + getDedicatedHostDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListBackupPolicies(listBackupPoliciesOptionsModel) + result, response, operationErr = vpcService.GetDedicatedHostDisk(getDedicatedHostDiskOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListBackupPolicies with error: Operation request error`, func() { + It(`Invoke GetDedicatedHostDisk with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -37661,22 +38174,26 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBackupPoliciesOptions model - listBackupPoliciesOptionsModel := new(vpcv1.ListBackupPoliciesOptions) - listBackupPoliciesOptionsModel.Start = core.StringPtr("testString") - listBackupPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBackupPoliciesOptionsModel.ResourceGroupID = core.StringPtr("testString") - listBackupPoliciesOptionsModel.Name = core.StringPtr("testString") - listBackupPoliciesOptionsModel.Tag = core.StringPtr("testString") - listBackupPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetDedicatedHostDiskOptions model + getDedicatedHostDiskOptionsModel := new(vpcv1.GetDedicatedHostDiskOptions) + getDedicatedHostDiskOptionsModel.DedicatedHostID = core.StringPtr("testString") + getDedicatedHostDiskOptionsModel.ID = core.StringPtr("testString") + getDedicatedHostDiskOptionsModel.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.ListBackupPolicies(listBackupPoliciesOptionsModel) + result, response, operationErr := vpcService.GetDedicatedHostDisk(getDedicatedHostDiskOptionsModel) 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 GetDedicatedHostDiskOptions model with no property values + getDedicatedHostDiskOptionsModelNew := new(vpcv1.GetDedicatedHostDiskOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetDedicatedHostDisk(getDedicatedHostDiskOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -37691,7 +38208,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListBackupPolicies successfully`, func() { + It(`Invoke GetDedicatedHostDisk successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -37700,17 +38217,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBackupPoliciesOptions model - listBackupPoliciesOptionsModel := new(vpcv1.ListBackupPoliciesOptions) - listBackupPoliciesOptionsModel.Start = core.StringPtr("testString") - listBackupPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBackupPoliciesOptionsModel.ResourceGroupID = core.StringPtr("testString") - listBackupPoliciesOptionsModel.Name = core.StringPtr("testString") - listBackupPoliciesOptionsModel.Tag = core.StringPtr("testString") - listBackupPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetDedicatedHostDiskOptions model + getDedicatedHostDiskOptionsModel := new(vpcv1.GetDedicatedHostDiskOptions) + getDedicatedHostDiskOptionsModel.DedicatedHostID = core.StringPtr("testString") + getDedicatedHostDiskOptionsModel.ID = core.StringPtr("testString") + getDedicatedHostDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListBackupPolicies(listBackupPoliciesOptionsModel) + result, response, operationErr := vpcService.GetDedicatedHostDisk(getDedicatedHostDiskOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -37721,133 +38235,26 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) - Context(`Test pagination helper method on response`, func() { - It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.BackupPolicyCollection) - nextObject := new(vpcv1.BackupPolicyCollectionNext) - 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.BackupPolicyCollection) - - 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.BackupPolicyCollection) - nextObject := new(vpcv1.BackupPolicyCollectionNext) - nextObject.Href = core.StringPtr("ibm.com") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - }) - Context(`Using mock server endpoint - paginated response`, func() { - BeforeEach(func() { - var requestNumber int = 0 - 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(listBackupPoliciesPath)) - Expect(req.Method).To(Equal("GET")) - - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - requestNumber++ - if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"backup_policies":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6","health_reasons":[{"code":"missing_service_authorization_policies","message":"One or more accounts are missing service authorization policies","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6","id":"r134-076191ba-49c2-4763-94fd-c70de73ee2e6","last_job_completed_at":"2019-01-01T12:00:00.000Z","lifecycle_state":"stable","match_user_tags":["MatchUserTags"],"name":"my-backup-policy","plans":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"}],"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"backup_policy","scope":{"crn":"crn:v1:bluemix:public:enterprise::a/123456::enterprise:ebc2b430240943458b9e91e1432cfcce","id":"fee82deba12e4c0fb69c3b09d1f12345","resource_type":"enterprise"},"included_content":["data_volumes"],"match_resource_type":"instance"}],"total_count":2,"limit":1}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"backup_policies":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6","health_reasons":[{"code":"missing_service_authorization_policies","message":"One or more accounts are missing service authorization policies","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6","id":"r134-076191ba-49c2-4763-94fd-c70de73ee2e6","last_job_completed_at":"2019-01-01T12:00:00.000Z","lifecycle_state":"stable","match_user_tags":["MatchUserTags"],"name":"my-backup-policy","plans":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"}],"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"backup_policy","scope":{"crn":"crn:v1:bluemix:public:enterprise::a/123456::enterprise:ebc2b430240943458b9e91e1432cfcce","id":"fee82deba12e4c0fb69c3b09d1f12345","resource_type":"enterprise"},"included_content":["data_volumes"],"match_resource_type":"instance"}],"total_count":2,"limit":1}`) - } else { - res.WriteHeader(400) - } - })) - }) - It(`Use BackupPoliciesPager.GetNext 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()) - - listBackupPoliciesOptionsModel := &vpcv1.ListBackupPoliciesOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - Name: core.StringPtr("testString"), - Tag: core.StringPtr("testString"), - } - - pager, err := vpcService.NewBackupPoliciesPager(listBackupPoliciesOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.BackupPolicyIntf - for pager.HasNext() { - nextPage, err := pager.GetNext() - Expect(err).To(BeNil()) - Expect(nextPage).ToNot(BeNil()) - allResults = append(allResults, nextPage...) - } - Expect(len(allResults)).To(Equal(2)) - }) - It(`Use BackupPoliciesPager.GetAll 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()) - - listBackupPoliciesOptionsModel := &vpcv1.ListBackupPoliciesOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - Name: core.StringPtr("testString"), - Tag: core.StringPtr("testString"), - } - - pager, err := vpcService.NewBackupPoliciesPager(listBackupPoliciesOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - allResults, err := pager.GetAll() - Expect(err).To(BeNil()) - Expect(allResults).ToNot(BeNil()) - Expect(len(allResults)).To(Equal(2)) - }) - }) }) - Describe(`CreateBackupPolicy(createBackupPolicyOptions *CreateBackupPolicyOptions) - Operation response error`, func() { + Describe(`UpdateDedicatedHostDisk(updateDedicatedHostDiskOptions *UpdateDedicatedHostDiskOptions) - Operation response error`, func() { version := "testString" - createBackupPolicyPath := "/backup_policies" + updateDedicatedHostDiskPath := "/dedicated_hosts/testString/disks/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(createBackupPolicyPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(updateDedicatedHostDiskPath)) + 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(201) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateBackupPolicy with error: Operation response processing error`, func() { + It(`Invoke UpdateDedicatedHostDisk with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -37856,75 +38263,27 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the BackupPolicyPlanClonePolicyPrototype model - backupPolicyPlanClonePolicyPrototypeModel := new(vpcv1.BackupPolicyPlanClonePolicyPrototype) - backupPolicyPlanClonePolicyPrototypeModel.MaxSnapshots = core.Int64Ptr(int64(5)) - backupPolicyPlanClonePolicyPrototypeModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} - - // Construct an instance of the BackupPolicyPlanDeletionTriggerPrototype model - backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the RegionIdentityByName model - regionIdentityModel := new(vpcv1.RegionIdentityByName) - regionIdentityModel.Name = core.StringPtr("us-south") - - // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model - backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel - backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel - - // Construct an instance of the BackupPolicyPlanPrototype model - backupPolicyPlanPrototypeModel := new(vpcv1.BackupPolicyPlanPrototype) - backupPolicyPlanPrototypeModel.Active = core.BoolPtr(true) - backupPolicyPlanPrototypeModel.AttachUserTags = []string{"my-daily-backup-plan"} - backupPolicyPlanPrototypeModel.ClonePolicy = backupPolicyPlanClonePolicyPrototypeModel - backupPolicyPlanPrototypeModel.CopyUserTags = core.BoolPtr(true) - backupPolicyPlanPrototypeModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - backupPolicyPlanPrototypeModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel - backupPolicyPlanPrototypeModel.Name = core.StringPtr("my-policy-plan") - backupPolicyPlanPrototypeModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN model - backupPolicyScopePrototypeModel := new(vpcv1.BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN) - backupPolicyScopePrototypeModel.CRN = core.StringPtr("crn:v1:bluemix:public:enterprise::a/123456::enterprise:ebc2b430240943458b9e91e1432cfcce") - - // Construct an instance of the BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype model - backupPolicyPrototypeModel := new(vpcv1.BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype) - backupPolicyPrototypeModel.MatchUserTags = []string{"my-daily-backup-policy"} - backupPolicyPrototypeModel.Name = core.StringPtr("my-backup-policy") - backupPolicyPrototypeModel.Plans = []vpcv1.BackupPolicyPlanPrototype{*backupPolicyPlanPrototypeModel} - backupPolicyPrototypeModel.ResourceGroup = resourceGroupIdentityModel - backupPolicyPrototypeModel.Scope = backupPolicyScopePrototypeModel - backupPolicyPrototypeModel.MatchResourceType = core.StringPtr("volume") + // Construct an instance of the DedicatedHostDiskPatch model + dedicatedHostDiskPatchModel := new(vpcv1.DedicatedHostDiskPatch) + dedicatedHostDiskPatchModel.Name = core.StringPtr("my-disk-updated") + dedicatedHostDiskPatchModelAsPatch, asPatchErr := dedicatedHostDiskPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) - // Construct an instance of the CreateBackupPolicyOptions model - createBackupPolicyOptionsModel := new(vpcv1.CreateBackupPolicyOptions) - createBackupPolicyOptionsModel.BackupPolicyPrototype = backupPolicyPrototypeModel - createBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateDedicatedHostDiskOptions model + updateDedicatedHostDiskOptionsModel := new(vpcv1.UpdateDedicatedHostDiskOptions) + updateDedicatedHostDiskOptionsModel.DedicatedHostID = core.StringPtr("testString") + updateDedicatedHostDiskOptionsModel.ID = core.StringPtr("testString") + updateDedicatedHostDiskOptionsModel.DedicatedHostDiskPatch = dedicatedHostDiskPatchModelAsPatch + updateDedicatedHostDiskOptionsModel.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.CreateBackupPolicy(createBackupPolicyOptionsModel) + result, response, operationErr := vpcService.UpdateDedicatedHostDisk(updateDedicatedHostDiskOptionsModel) 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.CreateBackupPolicy(createBackupPolicyOptionsModel) + result, response, operationErr = vpcService.UpdateDedicatedHostDisk(updateDedicatedHostDiskOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -37934,17 +38293,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateBackupPolicy(createBackupPolicyOptions *CreateBackupPolicyOptions)`, func() { + Describe(`UpdateDedicatedHostDisk(updateDedicatedHostDiskOptions *UpdateDedicatedHostDiskOptions)`, func() { version := "testString" - createBackupPolicyPath := "/backup_policies" + updateDedicatedHostDiskPath := "/dedicated_hosts/testString/disks/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(createBackupPolicyPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(updateDedicatedHostDiskPath)) + Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -37969,11 +38328,11 @@ 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", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_user_tags": ["MatchUserTags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/123456::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "fee82deba12e4c0fb69c3b09d1f12345", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}`) })) }) - It(`Invoke CreateBackupPolicy successfully with retries`, func() { + It(`Invoke UpdateDedicatedHostDisk successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -37983,77 +38342,29 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the BackupPolicyPlanClonePolicyPrototype model - backupPolicyPlanClonePolicyPrototypeModel := new(vpcv1.BackupPolicyPlanClonePolicyPrototype) - backupPolicyPlanClonePolicyPrototypeModel.MaxSnapshots = core.Int64Ptr(int64(5)) - backupPolicyPlanClonePolicyPrototypeModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} - - // Construct an instance of the BackupPolicyPlanDeletionTriggerPrototype model - backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the RegionIdentityByName model - regionIdentityModel := new(vpcv1.RegionIdentityByName) - regionIdentityModel.Name = core.StringPtr("us-south") - - // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model - backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel - backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel - - // Construct an instance of the BackupPolicyPlanPrototype model - backupPolicyPlanPrototypeModel := new(vpcv1.BackupPolicyPlanPrototype) - backupPolicyPlanPrototypeModel.Active = core.BoolPtr(true) - backupPolicyPlanPrototypeModel.AttachUserTags = []string{"my-daily-backup-plan"} - backupPolicyPlanPrototypeModel.ClonePolicy = backupPolicyPlanClonePolicyPrototypeModel - backupPolicyPlanPrototypeModel.CopyUserTags = core.BoolPtr(true) - backupPolicyPlanPrototypeModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - backupPolicyPlanPrototypeModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel - backupPolicyPlanPrototypeModel.Name = core.StringPtr("my-policy-plan") - backupPolicyPlanPrototypeModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN model - backupPolicyScopePrototypeModel := new(vpcv1.BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN) - backupPolicyScopePrototypeModel.CRN = core.StringPtr("crn:v1:bluemix:public:enterprise::a/123456::enterprise:ebc2b430240943458b9e91e1432cfcce") - - // Construct an instance of the BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype model - backupPolicyPrototypeModel := new(vpcv1.BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype) - backupPolicyPrototypeModel.MatchUserTags = []string{"my-daily-backup-policy"} - backupPolicyPrototypeModel.Name = core.StringPtr("my-backup-policy") - backupPolicyPrototypeModel.Plans = []vpcv1.BackupPolicyPlanPrototype{*backupPolicyPlanPrototypeModel} - backupPolicyPrototypeModel.ResourceGroup = resourceGroupIdentityModel - backupPolicyPrototypeModel.Scope = backupPolicyScopePrototypeModel - backupPolicyPrototypeModel.MatchResourceType = core.StringPtr("volume") + // Construct an instance of the DedicatedHostDiskPatch model + dedicatedHostDiskPatchModel := new(vpcv1.DedicatedHostDiskPatch) + dedicatedHostDiskPatchModel.Name = core.StringPtr("my-disk-updated") + dedicatedHostDiskPatchModelAsPatch, asPatchErr := dedicatedHostDiskPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) - // Construct an instance of the CreateBackupPolicyOptions model - createBackupPolicyOptionsModel := new(vpcv1.CreateBackupPolicyOptions) - createBackupPolicyOptionsModel.BackupPolicyPrototype = backupPolicyPrototypeModel - createBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateDedicatedHostDiskOptions model + updateDedicatedHostDiskOptionsModel := new(vpcv1.UpdateDedicatedHostDiskOptions) + updateDedicatedHostDiskOptionsModel.DedicatedHostID = core.StringPtr("testString") + updateDedicatedHostDiskOptionsModel.ID = core.StringPtr("testString") + updateDedicatedHostDiskOptionsModel.DedicatedHostDiskPatch = dedicatedHostDiskPatchModelAsPatch + updateDedicatedHostDiskOptionsModel.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.CreateBackupPolicyWithContext(ctx, createBackupPolicyOptionsModel) + _, _, operationErr := vpcService.UpdateDedicatedHostDiskWithContext(ctx, updateDedicatedHostDiskOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateBackupPolicy(createBackupPolicyOptionsModel) + result, response, operationErr := vpcService.UpdateDedicatedHostDisk(updateDedicatedHostDiskOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -38061,7 +38372,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreateBackupPolicyWithContext(ctx, createBackupPolicyOptionsModel) + _, _, operationErr = vpcService.UpdateDedicatedHostDiskWithContext(ctx, updateDedicatedHostDiskOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -38075,8 +38386,8 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createBackupPolicyPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(updateDedicatedHostDiskPath)) + Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -38098,11 +38409,11 @@ var _ = Describe(`VpcV1`, func() { 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", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_user_tags": ["MatchUserTags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/123456::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "fee82deba12e4c0fb69c3b09d1f12345", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}`) })) }) - It(`Invoke CreateBackupPolicy successfully`, func() { + It(`Invoke UpdateDedicatedHostDisk successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -38112,80 +38423,32 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreateBackupPolicy(nil) + result, response, operationErr := vpcService.UpdateDedicatedHostDisk(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the BackupPolicyPlanClonePolicyPrototype model - backupPolicyPlanClonePolicyPrototypeModel := new(vpcv1.BackupPolicyPlanClonePolicyPrototype) - backupPolicyPlanClonePolicyPrototypeModel.MaxSnapshots = core.Int64Ptr(int64(5)) - backupPolicyPlanClonePolicyPrototypeModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} - - // Construct an instance of the BackupPolicyPlanDeletionTriggerPrototype model - backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the RegionIdentityByName model - regionIdentityModel := new(vpcv1.RegionIdentityByName) - regionIdentityModel.Name = core.StringPtr("us-south") - - // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model - backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel - backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel - - // Construct an instance of the BackupPolicyPlanPrototype model - backupPolicyPlanPrototypeModel := new(vpcv1.BackupPolicyPlanPrototype) - backupPolicyPlanPrototypeModel.Active = core.BoolPtr(true) - backupPolicyPlanPrototypeModel.AttachUserTags = []string{"my-daily-backup-plan"} - backupPolicyPlanPrototypeModel.ClonePolicy = backupPolicyPlanClonePolicyPrototypeModel - backupPolicyPlanPrototypeModel.CopyUserTags = core.BoolPtr(true) - backupPolicyPlanPrototypeModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - backupPolicyPlanPrototypeModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel - backupPolicyPlanPrototypeModel.Name = core.StringPtr("my-policy-plan") - backupPolicyPlanPrototypeModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN model - backupPolicyScopePrototypeModel := new(vpcv1.BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN) - backupPolicyScopePrototypeModel.CRN = core.StringPtr("crn:v1:bluemix:public:enterprise::a/123456::enterprise:ebc2b430240943458b9e91e1432cfcce") - - // Construct an instance of the BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype model - backupPolicyPrototypeModel := new(vpcv1.BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype) - backupPolicyPrototypeModel.MatchUserTags = []string{"my-daily-backup-policy"} - backupPolicyPrototypeModel.Name = core.StringPtr("my-backup-policy") - backupPolicyPrototypeModel.Plans = []vpcv1.BackupPolicyPlanPrototype{*backupPolicyPlanPrototypeModel} - backupPolicyPrototypeModel.ResourceGroup = resourceGroupIdentityModel - backupPolicyPrototypeModel.Scope = backupPolicyScopePrototypeModel - backupPolicyPrototypeModel.MatchResourceType = core.StringPtr("volume") + // Construct an instance of the DedicatedHostDiskPatch model + dedicatedHostDiskPatchModel := new(vpcv1.DedicatedHostDiskPatch) + dedicatedHostDiskPatchModel.Name = core.StringPtr("my-disk-updated") + dedicatedHostDiskPatchModelAsPatch, asPatchErr := dedicatedHostDiskPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) - // Construct an instance of the CreateBackupPolicyOptions model - createBackupPolicyOptionsModel := new(vpcv1.CreateBackupPolicyOptions) - createBackupPolicyOptionsModel.BackupPolicyPrototype = backupPolicyPrototypeModel - createBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateDedicatedHostDiskOptions model + updateDedicatedHostDiskOptionsModel := new(vpcv1.UpdateDedicatedHostDiskOptions) + updateDedicatedHostDiskOptionsModel.DedicatedHostID = core.StringPtr("testString") + updateDedicatedHostDiskOptionsModel.ID = core.StringPtr("testString") + updateDedicatedHostDiskOptionsModel.DedicatedHostDiskPatch = dedicatedHostDiskPatchModelAsPatch + updateDedicatedHostDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateBackupPolicy(createBackupPolicyOptionsModel) + result, response, operationErr = vpcService.UpdateDedicatedHostDisk(updateDedicatedHostDiskOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateBackupPolicy with error: Operation validation and request error`, func() { + It(`Invoke UpdateDedicatedHostDisk with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -38194,78 +38457,30 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the BackupPolicyPlanClonePolicyPrototype model - backupPolicyPlanClonePolicyPrototypeModel := new(vpcv1.BackupPolicyPlanClonePolicyPrototype) - backupPolicyPlanClonePolicyPrototypeModel.MaxSnapshots = core.Int64Ptr(int64(5)) - backupPolicyPlanClonePolicyPrototypeModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} - - // Construct an instance of the BackupPolicyPlanDeletionTriggerPrototype model - backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the RegionIdentityByName model - regionIdentityModel := new(vpcv1.RegionIdentityByName) - regionIdentityModel.Name = core.StringPtr("us-south") - - // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model - backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel - backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel - - // Construct an instance of the BackupPolicyPlanPrototype model - backupPolicyPlanPrototypeModel := new(vpcv1.BackupPolicyPlanPrototype) - backupPolicyPlanPrototypeModel.Active = core.BoolPtr(true) - backupPolicyPlanPrototypeModel.AttachUserTags = []string{"my-daily-backup-plan"} - backupPolicyPlanPrototypeModel.ClonePolicy = backupPolicyPlanClonePolicyPrototypeModel - backupPolicyPlanPrototypeModel.CopyUserTags = core.BoolPtr(true) - backupPolicyPlanPrototypeModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - backupPolicyPlanPrototypeModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel - backupPolicyPlanPrototypeModel.Name = core.StringPtr("my-policy-plan") - backupPolicyPlanPrototypeModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN model - backupPolicyScopePrototypeModel := new(vpcv1.BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN) - backupPolicyScopePrototypeModel.CRN = core.StringPtr("crn:v1:bluemix:public:enterprise::a/123456::enterprise:ebc2b430240943458b9e91e1432cfcce") - - // Construct an instance of the BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype model - backupPolicyPrototypeModel := new(vpcv1.BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype) - backupPolicyPrototypeModel.MatchUserTags = []string{"my-daily-backup-policy"} - backupPolicyPrototypeModel.Name = core.StringPtr("my-backup-policy") - backupPolicyPrototypeModel.Plans = []vpcv1.BackupPolicyPlanPrototype{*backupPolicyPlanPrototypeModel} - backupPolicyPrototypeModel.ResourceGroup = resourceGroupIdentityModel - backupPolicyPrototypeModel.Scope = backupPolicyScopePrototypeModel - backupPolicyPrototypeModel.MatchResourceType = core.StringPtr("volume") + // Construct an instance of the DedicatedHostDiskPatch model + dedicatedHostDiskPatchModel := new(vpcv1.DedicatedHostDiskPatch) + dedicatedHostDiskPatchModel.Name = core.StringPtr("my-disk-updated") + dedicatedHostDiskPatchModelAsPatch, asPatchErr := dedicatedHostDiskPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) - // Construct an instance of the CreateBackupPolicyOptions model - createBackupPolicyOptionsModel := new(vpcv1.CreateBackupPolicyOptions) - createBackupPolicyOptionsModel.BackupPolicyPrototype = backupPolicyPrototypeModel - createBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateDedicatedHostDiskOptions model + updateDedicatedHostDiskOptionsModel := new(vpcv1.UpdateDedicatedHostDiskOptions) + updateDedicatedHostDiskOptionsModel.DedicatedHostID = core.StringPtr("testString") + updateDedicatedHostDiskOptionsModel.ID = core.StringPtr("testString") + updateDedicatedHostDiskOptionsModel.DedicatedHostDiskPatch = dedicatedHostDiskPatchModelAsPatch + updateDedicatedHostDiskOptionsModel.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.CreateBackupPolicy(createBackupPolicyOptionsModel) + result, response, operationErr := vpcService.UpdateDedicatedHostDisk(updateDedicatedHostDiskOptionsModel) 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 CreateBackupPolicyOptions model with no property values - createBackupPolicyOptionsModelNew := new(vpcv1.CreateBackupPolicyOptions) + // Construct a second instance of the UpdateDedicatedHostDiskOptions model with no property values + updateDedicatedHostDiskOptionsModelNew := new(vpcv1.UpdateDedicatedHostDiskOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateBackupPolicy(createBackupPolicyOptionsModelNew) + result, response, operationErr = vpcService.UpdateDedicatedHostDisk(updateDedicatedHostDiskOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -38280,10 +38495,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke CreateBackupPolicy successfully`, func() { + It(`Invoke UpdateDedicatedHostDisk successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -38292,107 +38507,124 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the BackupPolicyPlanClonePolicyPrototype model - backupPolicyPlanClonePolicyPrototypeModel := new(vpcv1.BackupPolicyPlanClonePolicyPrototype) - backupPolicyPlanClonePolicyPrototypeModel.MaxSnapshots = core.Int64Ptr(int64(5)) - backupPolicyPlanClonePolicyPrototypeModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} - - // Construct an instance of the BackupPolicyPlanDeletionTriggerPrototype model - backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + // Construct an instance of the DedicatedHostDiskPatch model + dedicatedHostDiskPatchModel := new(vpcv1.DedicatedHostDiskPatch) + dedicatedHostDiskPatchModel.Name = core.StringPtr("my-disk-updated") + dedicatedHostDiskPatchModelAsPatch, asPatchErr := dedicatedHostDiskPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) - // Construct an instance of the RegionIdentityByName model - regionIdentityModel := new(vpcv1.RegionIdentityByName) - regionIdentityModel.Name = core.StringPtr("us-south") + // Construct an instance of the UpdateDedicatedHostDiskOptions model + updateDedicatedHostDiskOptionsModel := new(vpcv1.UpdateDedicatedHostDiskOptions) + updateDedicatedHostDiskOptionsModel.DedicatedHostID = core.StringPtr("testString") + updateDedicatedHostDiskOptionsModel.ID = core.StringPtr("testString") + updateDedicatedHostDiskOptionsModel.DedicatedHostDiskPatch = dedicatedHostDiskPatchModelAsPatch + updateDedicatedHostDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model - backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel - backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel + // Invoke operation + result, response, operationErr := vpcService.UpdateDedicatedHostDisk(updateDedicatedHostDiskOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) - // Construct an instance of the BackupPolicyPlanPrototype model - backupPolicyPlanPrototypeModel := new(vpcv1.BackupPolicyPlanPrototype) - backupPolicyPlanPrototypeModel.Active = core.BoolPtr(true) - backupPolicyPlanPrototypeModel.AttachUserTags = []string{"my-daily-backup-plan"} - backupPolicyPlanPrototypeModel.ClonePolicy = backupPolicyPlanClonePolicyPrototypeModel - backupPolicyPlanPrototypeModel.CopyUserTags = core.BoolPtr(true) - backupPolicyPlanPrototypeModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - backupPolicyPlanPrototypeModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel - backupPolicyPlanPrototypeModel.Name = core.StringPtr("my-policy-plan") - backupPolicyPlanPrototypeModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteDedicatedHost(deleteDedicatedHostOptions *DeleteDedicatedHostOptions)`, func() { + version := "testString" + deleteDedicatedHostPath := "/dedicated_hosts/testString" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(deleteDedicatedHostPath)) + Expect(req.Method).To(Equal("DELETE")) - // Construct an instance of the BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN model - backupPolicyScopePrototypeModel := new(vpcv1.BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN) - backupPolicyScopePrototypeModel.CRN = core.StringPtr("crn:v1:bluemix:public:enterprise::a/123456::enterprise:ebc2b430240943458b9e91e1432cfcce") + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteDedicatedHost 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 BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype model - backupPolicyPrototypeModel := new(vpcv1.BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype) - backupPolicyPrototypeModel.MatchUserTags = []string{"my-daily-backup-policy"} - backupPolicyPrototypeModel.Name = core.StringPtr("my-backup-policy") - backupPolicyPrototypeModel.Plans = []vpcv1.BackupPolicyPlanPrototype{*backupPolicyPlanPrototypeModel} - backupPolicyPrototypeModel.ResourceGroup = resourceGroupIdentityModel - backupPolicyPrototypeModel.Scope = backupPolicyScopePrototypeModel - backupPolicyPrototypeModel.MatchResourceType = core.StringPtr("volume") + // Invoke operation with nil options model (negative test) + response, operationErr := vpcService.DeleteDedicatedHost(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) - // Construct an instance of the CreateBackupPolicyOptions model - createBackupPolicyOptionsModel := new(vpcv1.CreateBackupPolicyOptions) - createBackupPolicyOptionsModel.BackupPolicyPrototype = backupPolicyPrototypeModel - createBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteDedicatedHostOptions model + deleteDedicatedHostOptionsModel := new(vpcv1.DeleteDedicatedHostOptions) + deleteDedicatedHostOptionsModel.ID = core.StringPtr("testString") + deleteDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation - result, response, operationErr := vpcService.CreateBackupPolicy(createBackupPolicyOptionsModel) + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteDedicatedHost(deleteDedicatedHostOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteDedicatedHost 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()) - // Verify a nil result - Expect(result).To(BeNil()) + // Construct an instance of the DeleteDedicatedHostOptions model + deleteDedicatedHostOptionsModel := new(vpcv1.DeleteDedicatedHostOptions) + deleteDedicatedHostOptionsModel.ID = core.StringPtr("testString") + deleteDedicatedHostOptionsModel.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.DeleteDedicatedHost(deleteDedicatedHostOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteDedicatedHostOptions model with no property values + deleteDedicatedHostOptionsModelNew := new(vpcv1.DeleteDedicatedHostOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteDedicatedHost(deleteDedicatedHostOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`ListBackupPolicyJobs(listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions) - Operation response error`, func() { + Describe(`GetDedicatedHost(getDedicatedHostOptions *GetDedicatedHostOptions) - Operation response error`, func() { version := "testString" - listBackupPolicyJobsPath := "/backup_policies/testString/jobs" + getDedicatedHostPath := "/dedicated_hosts/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(listBackupPolicyJobsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getDedicatedHostPath)) 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()["status"]).To(Equal([]string{"failed"})) - Expect(req.URL.Query()["backup_policy_plan.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) - Expect(req.URL.Query()["source.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["target_snapshots[].id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["target_snapshots[].crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListBackupPolicyJobs with error: Operation response processing error`, func() { + It(`Invoke GetDedicatedHost with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -38401,27 +38633,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBackupPolicyJobsOptions model - listBackupPolicyJobsOptionsModel := new(vpcv1.ListBackupPolicyJobsOptions) - listBackupPolicyJobsOptionsModel.BackupPolicyID = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.Status = core.StringPtr("failed") - listBackupPolicyJobsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.Start = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBackupPolicyJobsOptionsModel.Sort = core.StringPtr("name") - listBackupPolicyJobsOptionsModel.SourceID = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.TargetSnapshotsID = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.TargetSnapshotsCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263") - listBackupPolicyJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetDedicatedHostOptions model + getDedicatedHostOptionsModel := new(vpcv1.GetDedicatedHostOptions) + getDedicatedHostOptionsModel.ID = core.StringPtr("testString") + getDedicatedHostOptionsModel.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.ListBackupPolicyJobs(listBackupPolicyJobsOptionsModel) + result, response, operationErr := vpcService.GetDedicatedHost(getDedicatedHostOptionsModel) 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.ListBackupPolicyJobs(listBackupPolicyJobsOptionsModel) + result, response, operationErr = vpcService.GetDedicatedHost(getDedicatedHostOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -38431,38 +38655,30 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListBackupPolicyJobs(listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions)`, func() { + Describe(`GetDedicatedHost(getDedicatedHostOptions *GetDedicatedHostOptions)`, func() { version := "testString" - listBackupPolicyJobsPath := "/backup_policies/testString/jobs" + getDedicatedHostPath := "/dedicated_hosts/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(listBackupPolicyJobsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getDedicatedHostPath)) 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()["status"]).To(Equal([]string{"failed"})) - Expect(req.URL.Query()["backup_policy_plan.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) - Expect(req.URL.Query()["source.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["target_snapshots[].id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["target_snapshots[].crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263"})) // 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/backup_policies/7241e2a8-601f-11ea-8503-000c29475bed/jobs?limit=20"}, "jobs": [{"auto_delete": true, "auto_delete_after": 90, "backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/0fe9e5d8-0a4d-4818-96ec-e99708644a58/jobs/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "job_type": "creation", "resource_type": "backup_policy_job", "source": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "status": "failed", "status_reasons": [{"code": "source_volume_busy", "message": "Message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshooting-backup-for-vpc"}], "target_snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/7241e2a8-601f-11ea-8503-000c29475bed/jobss?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke ListBackupPolicyJobs successfully with retries`, func() { + It(`Invoke GetDedicatedHost successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -38472,29 +38688,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListBackupPolicyJobsOptions model - listBackupPolicyJobsOptionsModel := new(vpcv1.ListBackupPolicyJobsOptions) - listBackupPolicyJobsOptionsModel.BackupPolicyID = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.Status = core.StringPtr("failed") - listBackupPolicyJobsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.Start = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBackupPolicyJobsOptionsModel.Sort = core.StringPtr("name") - listBackupPolicyJobsOptionsModel.SourceID = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.TargetSnapshotsID = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.TargetSnapshotsCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263") - listBackupPolicyJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetDedicatedHostOptions model + getDedicatedHostOptionsModel := new(vpcv1.GetDedicatedHostOptions) + getDedicatedHostOptionsModel.ID = core.StringPtr("testString") + getDedicatedHostOptionsModel.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.ListBackupPolicyJobsWithContext(ctx, listBackupPolicyJobsOptionsModel) + _, _, operationErr := vpcService.GetDedicatedHostWithContext(ctx, getDedicatedHostOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListBackupPolicyJobs(listBackupPolicyJobsOptionsModel) + result, response, operationErr := vpcService.GetDedicatedHost(getDedicatedHostOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -38502,7 +38710,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListBackupPolicyJobsWithContext(ctx, listBackupPolicyJobsOptionsModel) + _, _, operationErr = vpcService.GetDedicatedHostWithContext(ctx, getDedicatedHostOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -38516,26 +38724,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBackupPolicyJobsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getDedicatedHostPath)) 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()["status"]).To(Equal([]string{"failed"})) - Expect(req.URL.Query()["backup_policy_plan.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) - Expect(req.URL.Query()["source.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["target_snapshots[].id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["target_snapshots[].crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263"})) // 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/backup_policies/7241e2a8-601f-11ea-8503-000c29475bed/jobs?limit=20"}, "jobs": [{"auto_delete": true, "auto_delete_after": 90, "backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/0fe9e5d8-0a4d-4818-96ec-e99708644a58/jobs/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "job_type": "creation", "resource_type": "backup_policy_job", "source": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "status": "failed", "status_reasons": [{"code": "source_volume_busy", "message": "Message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshooting-backup-for-vpc"}], "target_snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/7241e2a8-601f-11ea-8503-000c29475bed/jobss?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke ListBackupPolicyJobs successfully`, func() { + It(`Invoke GetDedicatedHost successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -38545,32 +38745,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListBackupPolicyJobs(nil) + result, response, operationErr := vpcService.GetDedicatedHost(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListBackupPolicyJobsOptions model - listBackupPolicyJobsOptionsModel := new(vpcv1.ListBackupPolicyJobsOptions) - listBackupPolicyJobsOptionsModel.BackupPolicyID = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.Status = core.StringPtr("failed") - listBackupPolicyJobsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.Start = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBackupPolicyJobsOptionsModel.Sort = core.StringPtr("name") - listBackupPolicyJobsOptionsModel.SourceID = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.TargetSnapshotsID = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.TargetSnapshotsCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263") - listBackupPolicyJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetDedicatedHostOptions model + getDedicatedHostOptionsModel := new(vpcv1.GetDedicatedHostOptions) + getDedicatedHostOptionsModel.ID = core.StringPtr("testString") + getDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListBackupPolicyJobs(listBackupPolicyJobsOptionsModel) + result, response, operationErr = vpcService.GetDedicatedHost(getDedicatedHostOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListBackupPolicyJobs with error: Operation validation and request error`, func() { + It(`Invoke GetDedicatedHost with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -38579,30 +38771,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBackupPolicyJobsOptions model - listBackupPolicyJobsOptionsModel := new(vpcv1.ListBackupPolicyJobsOptions) - listBackupPolicyJobsOptionsModel.BackupPolicyID = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.Status = core.StringPtr("failed") - listBackupPolicyJobsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.Start = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBackupPolicyJobsOptionsModel.Sort = core.StringPtr("name") - listBackupPolicyJobsOptionsModel.SourceID = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.TargetSnapshotsID = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.TargetSnapshotsCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263") - listBackupPolicyJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetDedicatedHostOptions model + getDedicatedHostOptionsModel := new(vpcv1.GetDedicatedHostOptions) + getDedicatedHostOptionsModel.ID = core.StringPtr("testString") + getDedicatedHostOptionsModel.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.ListBackupPolicyJobs(listBackupPolicyJobsOptionsModel) + result, response, operationErr := vpcService.GetDedicatedHost(getDedicatedHostOptionsModel) 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 ListBackupPolicyJobsOptions model with no property values - listBackupPolicyJobsOptionsModelNew := new(vpcv1.ListBackupPolicyJobsOptions) + // Construct a second instance of the GetDedicatedHostOptions model with no property values + getDedicatedHostOptionsModelNew := new(vpcv1.GetDedicatedHostOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListBackupPolicyJobs(listBackupPolicyJobsOptionsModelNew) + result, response, operationErr = vpcService.GetDedicatedHost(getDedicatedHostOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -38620,7 +38804,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListBackupPolicyJobs successfully`, func() { + It(`Invoke GetDedicatedHost successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -38629,21 +38813,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBackupPolicyJobsOptions model - listBackupPolicyJobsOptionsModel := new(vpcv1.ListBackupPolicyJobsOptions) - listBackupPolicyJobsOptionsModel.BackupPolicyID = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.Status = core.StringPtr("failed") - listBackupPolicyJobsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.Start = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBackupPolicyJobsOptionsModel.Sort = core.StringPtr("name") - listBackupPolicyJobsOptionsModel.SourceID = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.TargetSnapshotsID = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.TargetSnapshotsCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263") - listBackupPolicyJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetDedicatedHostOptions model + getDedicatedHostOptionsModel := new(vpcv1.GetDedicatedHostOptions) + getDedicatedHostOptionsModel.ID = core.StringPtr("testString") + getDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListBackupPolicyJobs(listBackupPolicyJobsOptionsModel) + result, response, operationErr := vpcService.GetDedicatedHost(getDedicatedHostOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -38654,59 +38830,104 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) - Context(`Test pagination helper method on response`, func() { - It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.BackupPolicyJobCollection) - nextObject := new(vpcv1.BackupPolicyJobCollectionNext) - nextObject.Href = core.StringPtr("ibm.com?start=abc-123") - responseObject.Next = nextObject + }) + Describe(`UpdateDedicatedHost(updateDedicatedHostOptions *UpdateDedicatedHostOptions) - Operation response error`, func() { + version := "testString" + updateDedicatedHostPath := "/dedicated_hosts/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() - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(Equal(core.StringPtr("abc-123"))) + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updateDedicatedHostPath)) + 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 GetNextStart without a "Next" property in the response`, func() { - responseObject := new(vpcv1.BackupPolicyJobCollection) + It(`Invoke UpdateDedicatedHost 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()) - 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.BackupPolicyJobCollection) - nextObject := new(vpcv1.BackupPolicyJobCollectionNext) - nextObject.Href = core.StringPtr("ibm.com") - responseObject.Next = nextObject + // Construct an instance of the DedicatedHostPatch model + dedicatedHostPatchModel := new(vpcv1.DedicatedHostPatch) + dedicatedHostPatchModel.InstancePlacementEnabled = core.BoolPtr(true) + dedicatedHostPatchModel.Name = core.StringPtr("my-host") + dedicatedHostPatchModelAsPatch, asPatchErr := dedicatedHostPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) + // Construct an instance of the UpdateDedicatedHostOptions model + updateDedicatedHostOptionsModel := new(vpcv1.UpdateDedicatedHostOptions) + updateDedicatedHostOptionsModel.ID = core.StringPtr("testString") + updateDedicatedHostOptionsModel.DedicatedHostPatch = dedicatedHostPatchModelAsPatch + updateDedicatedHostOptionsModel.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.UpdateDedicatedHost(updateDedicatedHostOptionsModel) + 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.UpdateDedicatedHost(updateDedicatedHostOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() }) }) - Context(`Using mock server endpoint - paginated response`, func() { + }) + Describe(`UpdateDedicatedHost(updateDedicatedHostOptions *UpdateDedicatedHostOptions)`, func() { + version := "testString" + updateDedicatedHostPath := "/dedicated_hosts/testString" + Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { - var requestNumber int = 0 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(listBackupPolicyJobsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateDedicatedHostPath)) + 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) - requestNumber++ - if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"jobs":[{"auto_delete":true,"auto_delete_after":90,"backup_policy_plan":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"completed_at":"2019-01-01T12:00:00.000Z","created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/0fe9e5d8-0a4d-4818-96ec-e99708644a58/jobs/4cf9171a-0043-4434-8727-15b53dbc374c","id":"4cf9171a-0043-4434-8727-15b53dbc374c","job_type":"creation","resource_type":"backup_policy_job","source":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"volume"},"status":"failed","status_reasons":[{"code":"source_volume_busy","message":"Message","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshooting-backup-for-vpc"}],"target_snapshots":[{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}]}],"limit":1}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"jobs":[{"auto_delete":true,"auto_delete_after":90,"backup_policy_plan":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"completed_at":"2019-01-01T12:00:00.000Z","created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/0fe9e5d8-0a4d-4818-96ec-e99708644a58/jobs/4cf9171a-0043-4434-8727-15b53dbc374c","id":"4cf9171a-0043-4434-8727-15b53dbc374c","job_type":"creation","resource_type":"backup_policy_job","source":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"volume"},"status":"failed","status_reasons":[{"code":"source_volume_busy","message":"Message","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshooting-backup-for-vpc"}],"target_snapshots":[{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}]}],"limit":1}`) - } else { - res.WriteHeader(400) - } + fmt.Fprintf(res, "%s", `{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Use BackupPolicyJobsPager.GetNext successfully`, func() { + It(`Invoke UpdateDedicatedHost successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -38714,161 +38935,31 @@ var _ = Describe(`VpcV1`, func() { }) Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) - listBackupPolicyJobsOptionsModel := &vpcv1.ListBackupPolicyJobsOptions{ - BackupPolicyID: core.StringPtr("testString"), - Status: core.StringPtr("failed"), - BackupPolicyPlanID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - Sort: core.StringPtr("name"), - SourceID: core.StringPtr("testString"), - TargetSnapshotsID: core.StringPtr("testString"), - TargetSnapshotsCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263"), - } - - pager, err := vpcService.NewBackupPolicyJobsPager(listBackupPolicyJobsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.BackupPolicyJob - for pager.HasNext() { - nextPage, err := pager.GetNext() - Expect(err).To(BeNil()) - Expect(nextPage).ToNot(BeNil()) - allResults = append(allResults, nextPage...) - } - Expect(len(allResults)).To(Equal(2)) - }) - It(`Use BackupPolicyJobsPager.GetAll 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()) - - listBackupPolicyJobsOptionsModel := &vpcv1.ListBackupPolicyJobsOptions{ - BackupPolicyID: core.StringPtr("testString"), - Status: core.StringPtr("failed"), - BackupPolicyPlanID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - Sort: core.StringPtr("name"), - SourceID: core.StringPtr("testString"), - TargetSnapshotsID: core.StringPtr("testString"), - TargetSnapshotsCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263"), - } - - pager, err := vpcService.NewBackupPolicyJobsPager(listBackupPolicyJobsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - allResults, err := pager.GetAll() - Expect(err).To(BeNil()) - Expect(allResults).ToNot(BeNil()) - Expect(len(allResults)).To(Equal(2)) - }) - }) - }) - Describe(`GetBackupPolicyJob(getBackupPolicyJobOptions *GetBackupPolicyJobOptions) - Operation response error`, func() { - version := "testString" - getBackupPolicyJobPath := "/backup_policies/testString/jobs/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(getBackupPolicyJobPath)) - 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 GetBackupPolicyJob 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 GetBackupPolicyJobOptions model - getBackupPolicyJobOptionsModel := new(vpcv1.GetBackupPolicyJobOptions) - getBackupPolicyJobOptionsModel.BackupPolicyID = core.StringPtr("testString") - getBackupPolicyJobOptionsModel.ID = core.StringPtr("testString") - getBackupPolicyJobOptionsModel.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.GetBackupPolicyJob(getBackupPolicyJobOptionsModel) - 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.GetBackupPolicyJob(getBackupPolicyJobOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetBackupPolicyJob(getBackupPolicyJobOptions *GetBackupPolicyJobOptions)`, func() { - version := "testString" - getBackupPolicyJobPath := "/backup_policies/testString/jobs/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(getBackupPolicyJobPath)) - 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", `{"auto_delete": true, "auto_delete_after": 90, "backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/0fe9e5d8-0a4d-4818-96ec-e99708644a58/jobs/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "job_type": "creation", "resource_type": "backup_policy_job", "source": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "status": "failed", "status_reasons": [{"code": "source_volume_busy", "message": "Message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshooting-backup-for-vpc"}], "target_snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}`) - })) - }) - It(`Invoke GetBackupPolicyJob 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 DedicatedHostPatch model + dedicatedHostPatchModel := new(vpcv1.DedicatedHostPatch) + dedicatedHostPatchModel.InstancePlacementEnabled = core.BoolPtr(true) + dedicatedHostPatchModel.Name = core.StringPtr("my-host") + dedicatedHostPatchModelAsPatch, asPatchErr := dedicatedHostPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) - // Construct an instance of the GetBackupPolicyJobOptions model - getBackupPolicyJobOptionsModel := new(vpcv1.GetBackupPolicyJobOptions) - getBackupPolicyJobOptionsModel.BackupPolicyID = core.StringPtr("testString") - getBackupPolicyJobOptionsModel.ID = core.StringPtr("testString") - getBackupPolicyJobOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateDedicatedHostOptions model + updateDedicatedHostOptionsModel := new(vpcv1.UpdateDedicatedHostOptions) + updateDedicatedHostOptionsModel.ID = core.StringPtr("testString") + updateDedicatedHostOptionsModel.DedicatedHostPatch = dedicatedHostPatchModelAsPatch + updateDedicatedHostOptionsModel.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.GetBackupPolicyJobWithContext(ctx, getBackupPolicyJobOptionsModel) + _, _, operationErr := vpcService.UpdateDedicatedHostWithContext(ctx, updateDedicatedHostOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetBackupPolicyJob(getBackupPolicyJobOptionsModel) + result, response, operationErr := vpcService.UpdateDedicatedHost(updateDedicatedHostOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -38876,7 +38967,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetBackupPolicyJobWithContext(ctx, getBackupPolicyJobOptionsModel) + _, _, operationErr = vpcService.UpdateDedicatedHostWithContext(ctx, updateDedicatedHostOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -38890,18 +38981,34 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBackupPolicyJobPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateDedicatedHostPath)) + 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", `{"auto_delete": true, "auto_delete_after": 90, "backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/0fe9e5d8-0a4d-4818-96ec-e99708644a58/jobs/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "job_type": "creation", "resource_type": "backup_policy_job", "source": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "status": "failed", "status_reasons": [{"code": "source_volume_busy", "message": "Message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshooting-backup-for-vpc"}], "target_snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}`) + fmt.Fprintf(res, "%s", `{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"available": 9, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "instance_disks": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-disk", "resource_type": "instance_disk"}], "interface_type": "nvme", "lifecycle_state": "stable", "name": "my-dedicated-host-disk", "provisionable": false, "resource_type": "dedicated_host_disk", "size": 4, "supported_instance_interface_types": ["nvme"]}], "group": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/groups/bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "id": "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "name": "my-host-group", "resource_type": "dedicated_host_group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "numa": {"count": 2, "nodes": [{"available_vcpu": 24, "vcpu": 56}]}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "mx2-host-152x1216"}, "provisionable": false, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "dedicated_host", "socket_count": 4, "state": "available", "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "vcpu": {"architecture": "amd64", "count": 4, "manufacturer": "intel"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke GetBackupPolicyJob successfully`, func() { + It(`Invoke UpdateDedicatedHost successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -38911,25 +39018,32 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetBackupPolicyJob(nil) + result, response, operationErr := vpcService.UpdateDedicatedHost(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetBackupPolicyJobOptions model - getBackupPolicyJobOptionsModel := new(vpcv1.GetBackupPolicyJobOptions) - getBackupPolicyJobOptionsModel.BackupPolicyID = core.StringPtr("testString") - getBackupPolicyJobOptionsModel.ID = core.StringPtr("testString") - getBackupPolicyJobOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DedicatedHostPatch model + dedicatedHostPatchModel := new(vpcv1.DedicatedHostPatch) + dedicatedHostPatchModel.InstancePlacementEnabled = core.BoolPtr(true) + dedicatedHostPatchModel.Name = core.StringPtr("my-host") + dedicatedHostPatchModelAsPatch, asPatchErr := dedicatedHostPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateDedicatedHostOptions model + updateDedicatedHostOptionsModel := new(vpcv1.UpdateDedicatedHostOptions) + updateDedicatedHostOptionsModel.ID = core.StringPtr("testString") + updateDedicatedHostOptionsModel.DedicatedHostPatch = dedicatedHostPatchModelAsPatch + updateDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetBackupPolicyJob(getBackupPolicyJobOptionsModel) + result, response, operationErr = vpcService.UpdateDedicatedHost(updateDedicatedHostOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetBackupPolicyJob with error: Operation validation and request error`, func() { + It(`Invoke UpdateDedicatedHost with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -38938,23 +39052,30 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBackupPolicyJobOptions model - getBackupPolicyJobOptionsModel := new(vpcv1.GetBackupPolicyJobOptions) - getBackupPolicyJobOptionsModel.BackupPolicyID = core.StringPtr("testString") - getBackupPolicyJobOptionsModel.ID = core.StringPtr("testString") - getBackupPolicyJobOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DedicatedHostPatch model + dedicatedHostPatchModel := new(vpcv1.DedicatedHostPatch) + dedicatedHostPatchModel.InstancePlacementEnabled = core.BoolPtr(true) + dedicatedHostPatchModel.Name = core.StringPtr("my-host") + dedicatedHostPatchModelAsPatch, asPatchErr := dedicatedHostPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateDedicatedHostOptions model + updateDedicatedHostOptionsModel := new(vpcv1.UpdateDedicatedHostOptions) + updateDedicatedHostOptionsModel.ID = core.StringPtr("testString") + updateDedicatedHostOptionsModel.DedicatedHostPatch = dedicatedHostPatchModelAsPatch + updateDedicatedHostOptionsModel.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.GetBackupPolicyJob(getBackupPolicyJobOptionsModel) + result, response, operationErr := vpcService.UpdateDedicatedHost(updateDedicatedHostOptionsModel) 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 GetBackupPolicyJobOptions model with no property values - getBackupPolicyJobOptionsModelNew := new(vpcv1.GetBackupPolicyJobOptions) + // Construct a second instance of the UpdateDedicatedHostOptions model with no property values + updateDedicatedHostOptionsModelNew := new(vpcv1.UpdateDedicatedHostOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetBackupPolicyJob(getBackupPolicyJobOptionsModelNew) + result, response, operationErr = vpcService.UpdateDedicatedHost(updateDedicatedHostOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -38972,7 +39093,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetBackupPolicyJob successfully`, func() { + It(`Invoke UpdateDedicatedHost successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -38981,14 +39102,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBackupPolicyJobOptions model - getBackupPolicyJobOptionsModel := new(vpcv1.GetBackupPolicyJobOptions) - getBackupPolicyJobOptionsModel.BackupPolicyID = core.StringPtr("testString") - getBackupPolicyJobOptionsModel.ID = core.StringPtr("testString") - getBackupPolicyJobOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DedicatedHostPatch model + dedicatedHostPatchModel := new(vpcv1.DedicatedHostPatch) + dedicatedHostPatchModel.InstancePlacementEnabled = core.BoolPtr(true) + dedicatedHostPatchModel.Name = core.StringPtr("my-host") + dedicatedHostPatchModelAsPatch, asPatchErr := dedicatedHostPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateDedicatedHostOptions model + updateDedicatedHostOptionsModel := new(vpcv1.UpdateDedicatedHostOptions) + updateDedicatedHostOptionsModel.ID = core.StringPtr("testString") + updateDedicatedHostOptionsModel.DedicatedHostPatch = dedicatedHostPatchModelAsPatch + updateDedicatedHostOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetBackupPolicyJob(getBackupPolicyJobOptionsModel) + result, response, operationErr := vpcService.UpdateDedicatedHost(updateDedicatedHostOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -39000,26 +39128,30 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListBackupPolicyPlans(listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) - Operation response error`, func() { + Describe(`ListBackupPolicies(listBackupPoliciesOptions *ListBackupPoliciesOptions) - Operation response error`, func() { version := "testString" - listBackupPolicyPlansPath := "/backup_policies/testString/plans" + listBackupPoliciesPath := "/backup_policies" 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(listBackupPolicyPlansPath)) + Expect(req.URL.EscapedPath()).To(Equal(listBackupPoliciesPath)) 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(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["tag"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListBackupPolicyPlans with error: Operation response processing error`, func() { + It(`Invoke ListBackupPolicies with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -39028,20 +39160,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBackupPolicyPlansOptions model - listBackupPolicyPlansOptionsModel := new(vpcv1.ListBackupPolicyPlansOptions) - listBackupPolicyPlansOptionsModel.BackupPolicyID = core.StringPtr("testString") - listBackupPolicyPlansOptionsModel.Name = core.StringPtr("testString") - listBackupPolicyPlansOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBackupPoliciesOptions model + listBackupPoliciesOptionsModel := new(vpcv1.ListBackupPoliciesOptions) + listBackupPoliciesOptionsModel.Start = core.StringPtr("testString") + listBackupPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBackupPoliciesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listBackupPoliciesOptionsModel.Name = core.StringPtr("testString") + listBackupPoliciesOptionsModel.Tag = core.StringPtr("testString") + listBackupPoliciesOptionsModel.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.ListBackupPolicyPlans(listBackupPolicyPlansOptionsModel) + result, response, operationErr := vpcService.ListBackupPolicies(listBackupPoliciesOptionsModel) 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.ListBackupPolicyPlans(listBackupPolicyPlansOptionsModel) + result, response, operationErr = vpcService.ListBackupPolicies(listBackupPoliciesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -39051,31 +39186,35 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListBackupPolicyPlans(listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions)`, func() { + Describe(`ListBackupPolicies(listBackupPoliciesOptions *ListBackupPoliciesOptions)`, func() { version := "testString" - listBackupPolicyPlansPath := "/backup_policies/testString/plans" + listBackupPoliciesPath := "/backup_policies" 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(listBackupPolicyPlansPath)) + Expect(req.URL.EscapedPath()).To(Equal(listBackupPoliciesPath)) 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(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["tag"]).To(Equal([]string{"testString"})) // 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", `{"plans": [{"active": true, "attach_user_tags": ["AttachUserTags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}]}`) + fmt.Fprintf(res, "%s", `{"backup_policies": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_user_tags": ["MatchUserTags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/123456::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "fee82deba12e4c0fb69c3b09d1f12345", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) })) }) - It(`Invoke ListBackupPolicyPlans successfully with retries`, func() { + It(`Invoke ListBackupPolicies successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -39085,22 +39224,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListBackupPolicyPlansOptions model - listBackupPolicyPlansOptionsModel := new(vpcv1.ListBackupPolicyPlansOptions) - listBackupPolicyPlansOptionsModel.BackupPolicyID = core.StringPtr("testString") - listBackupPolicyPlansOptionsModel.Name = core.StringPtr("testString") - listBackupPolicyPlansOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBackupPoliciesOptions model + listBackupPoliciesOptionsModel := new(vpcv1.ListBackupPoliciesOptions) + listBackupPoliciesOptionsModel.Start = core.StringPtr("testString") + listBackupPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBackupPoliciesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listBackupPoliciesOptionsModel.Name = core.StringPtr("testString") + listBackupPoliciesOptionsModel.Tag = core.StringPtr("testString") + listBackupPoliciesOptionsModel.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.ListBackupPolicyPlansWithContext(ctx, listBackupPolicyPlansOptionsModel) + _, _, operationErr := vpcService.ListBackupPoliciesWithContext(ctx, listBackupPoliciesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListBackupPolicyPlans(listBackupPolicyPlansOptionsModel) + result, response, operationErr := vpcService.ListBackupPolicies(listBackupPoliciesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -39108,7 +39250,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListBackupPolicyPlansWithContext(ctx, listBackupPolicyPlansOptionsModel) + _, _, operationErr = vpcService.ListBackupPoliciesWithContext(ctx, listBackupPoliciesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -39122,19 +39264,23 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBackupPolicyPlansPath)) + Expect(req.URL.EscapedPath()).To(Equal(listBackupPoliciesPath)) 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(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["tag"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"plans": [{"active": true, "attach_user_tags": ["AttachUserTags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}]}`) + fmt.Fprintf(res, "%s", `{"backup_policies": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_user_tags": ["MatchUserTags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/123456::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "fee82deba12e4c0fb69c3b09d1f12345", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) })) }) - It(`Invoke ListBackupPolicyPlans successfully`, func() { + It(`Invoke ListBackupPolicies successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -39144,25 +39290,28 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListBackupPolicyPlans(nil) + result, response, operationErr := vpcService.ListBackupPolicies(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListBackupPolicyPlansOptions model - listBackupPolicyPlansOptionsModel := new(vpcv1.ListBackupPolicyPlansOptions) - listBackupPolicyPlansOptionsModel.BackupPolicyID = core.StringPtr("testString") - listBackupPolicyPlansOptionsModel.Name = core.StringPtr("testString") - listBackupPolicyPlansOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBackupPoliciesOptions model + listBackupPoliciesOptionsModel := new(vpcv1.ListBackupPoliciesOptions) + listBackupPoliciesOptionsModel.Start = core.StringPtr("testString") + listBackupPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBackupPoliciesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listBackupPoliciesOptionsModel.Name = core.StringPtr("testString") + listBackupPoliciesOptionsModel.Tag = core.StringPtr("testString") + listBackupPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListBackupPolicyPlans(listBackupPolicyPlansOptionsModel) + result, response, operationErr = vpcService.ListBackupPolicies(listBackupPoliciesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListBackupPolicyPlans with error: Operation validation and request error`, func() { + It(`Invoke ListBackupPolicies with error: Operation request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -39171,26 +39320,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBackupPolicyPlansOptions model - listBackupPolicyPlansOptionsModel := new(vpcv1.ListBackupPolicyPlansOptions) - listBackupPolicyPlansOptionsModel.BackupPolicyID = core.StringPtr("testString") - listBackupPolicyPlansOptionsModel.Name = core.StringPtr("testString") - listBackupPolicyPlansOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBackupPoliciesOptions model + listBackupPoliciesOptionsModel := new(vpcv1.ListBackupPoliciesOptions) + listBackupPoliciesOptionsModel.Start = core.StringPtr("testString") + listBackupPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBackupPoliciesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listBackupPoliciesOptionsModel.Name = core.StringPtr("testString") + listBackupPoliciesOptionsModel.Tag = core.StringPtr("testString") + listBackupPoliciesOptionsModel.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.ListBackupPolicyPlans(listBackupPolicyPlansOptionsModel) + result, response, operationErr := vpcService.ListBackupPolicies(listBackupPoliciesOptionsModel) 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 ListBackupPolicyPlansOptions model with no property values - listBackupPolicyPlansOptionsModelNew := new(vpcv1.ListBackupPolicyPlansOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListBackupPolicyPlans(listBackupPolicyPlansOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -39205,7 +39350,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListBackupPolicyPlans successfully`, func() { + It(`Invoke ListBackupPolicies successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -39214,14 +39359,17 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBackupPolicyPlansOptions model - listBackupPolicyPlansOptionsModel := new(vpcv1.ListBackupPolicyPlansOptions) - listBackupPolicyPlansOptionsModel.BackupPolicyID = core.StringPtr("testString") - listBackupPolicyPlansOptionsModel.Name = core.StringPtr("testString") - listBackupPolicyPlansOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBackupPoliciesOptions model + listBackupPoliciesOptionsModel := new(vpcv1.ListBackupPoliciesOptions) + listBackupPoliciesOptionsModel.Start = core.StringPtr("testString") + listBackupPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBackupPoliciesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listBackupPoliciesOptionsModel.Name = core.StringPtr("testString") + listBackupPoliciesOptionsModel.Tag = core.StringPtr("testString") + listBackupPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListBackupPolicyPlans(listBackupPolicyPlansOptionsModel) + result, response, operationErr := vpcService.ListBackupPolicies(listBackupPoliciesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -39232,17 +39380,124 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(vpcv1.BackupPolicyCollection) + nextObject := new(vpcv1.BackupPolicyCollectionNext) + 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.BackupPolicyCollection) + + 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.BackupPolicyCollection) + nextObject := new(vpcv1.BackupPolicyCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { + BeforeEach(func() { + var requestNumber int = 0 + 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(listBackupPoliciesPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"backup_policies":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6","health_reasons":[{"code":"missing_service_authorization_policies","message":"One or more accounts are missing service authorization policies","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6","id":"r134-076191ba-49c2-4763-94fd-c70de73ee2e6","last_job_completed_at":"2019-01-01T12:00:00.000Z","lifecycle_state":"stable","match_user_tags":["MatchUserTags"],"name":"my-backup-policy","plans":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"}],"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"backup_policy","scope":{"crn":"crn:v1:bluemix:public:enterprise::a/123456::enterprise:ebc2b430240943458b9e91e1432cfcce","id":"fee82deba12e4c0fb69c3b09d1f12345","resource_type":"enterprise"},"included_content":["data_volumes"],"match_resource_type":"instance"}],"total_count":2,"limit":1}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"backup_policies":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6","health_reasons":[{"code":"missing_service_authorization_policies","message":"One or more accounts are missing service authorization policies","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6","id":"r134-076191ba-49c2-4763-94fd-c70de73ee2e6","last_job_completed_at":"2019-01-01T12:00:00.000Z","lifecycle_state":"stable","match_user_tags":["MatchUserTags"],"name":"my-backup-policy","plans":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"}],"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"backup_policy","scope":{"crn":"crn:v1:bluemix:public:enterprise::a/123456::enterprise:ebc2b430240943458b9e91e1432cfcce","id":"fee82deba12e4c0fb69c3b09d1f12345","resource_type":"enterprise"},"included_content":["data_volumes"],"match_resource_type":"instance"}],"total_count":2,"limit":1}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use BackupPoliciesPager.GetNext 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()) + + listBackupPoliciesOptionsModel := &vpcv1.ListBackupPoliciesOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + Name: core.StringPtr("testString"), + Tag: core.StringPtr("testString"), + } + + pager, err := vpcService.NewBackupPoliciesPager(listBackupPoliciesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.BackupPolicyIntf + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) + }) + It(`Use BackupPoliciesPager.GetAll 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()) + + listBackupPoliciesOptionsModel := &vpcv1.ListBackupPoliciesOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + Name: core.StringPtr("testString"), + Tag: core.StringPtr("testString"), + } + + pager, err := vpcService.NewBackupPoliciesPager(listBackupPoliciesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) + }) + }) }) - Describe(`CreateBackupPolicyPlan(createBackupPolicyPlanOptions *CreateBackupPolicyPlanOptions) - Operation response error`, func() { + Describe(`CreateBackupPolicy(createBackupPolicyOptions *CreateBackupPolicyOptions) - Operation response error`, func() { version := "testString" - createBackupPolicyPlanPath := "/backup_policies/testString/plans" + createBackupPolicyPath := "/backup_policies" 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(createBackupPolicyPlanPath)) + Expect(req.URL.EscapedPath()).To(Equal(createBackupPolicyPath)) 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))})) @@ -39251,7 +39506,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateBackupPolicyPlan with error: Operation response processing error`, func() { + It(`Invoke CreateBackupPolicy with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -39288,27 +39543,47 @@ var _ = Describe(`VpcV1`, func() { backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel - // Construct an instance of the CreateBackupPolicyPlanOptions model - createBackupPolicyPlanOptionsModel := new(vpcv1.CreateBackupPolicyPlanOptions) - createBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - createBackupPolicyPlanOptionsModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - createBackupPolicyPlanOptionsModel.Active = core.BoolPtr(true) - createBackupPolicyPlanOptionsModel.AttachUserTags = []string{"my-daily-backup-plan"} - createBackupPolicyPlanOptionsModel.ClonePolicy = backupPolicyPlanClonePolicyPrototypeModel - createBackupPolicyPlanOptionsModel.CopyUserTags = core.BoolPtr(true) - createBackupPolicyPlanOptionsModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel - createBackupPolicyPlanOptionsModel.Name = core.StringPtr("my-policy-plan") - createBackupPolicyPlanOptionsModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} - createBackupPolicyPlanOptionsModel.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.CreateBackupPolicyPlan(createBackupPolicyPlanOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) + // Construct an instance of the BackupPolicyPlanPrototype model + backupPolicyPlanPrototypeModel := new(vpcv1.BackupPolicyPlanPrototype) + backupPolicyPlanPrototypeModel.Active = core.BoolPtr(true) + backupPolicyPlanPrototypeModel.AttachUserTags = []string{"my-daily-backup-plan"} + backupPolicyPlanPrototypeModel.ClonePolicy = backupPolicyPlanClonePolicyPrototypeModel + backupPolicyPlanPrototypeModel.CopyUserTags = core.BoolPtr(true) + backupPolicyPlanPrototypeModel.CronSpec = core.StringPtr("30 */2 * * 1-5") + backupPolicyPlanPrototypeModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel + backupPolicyPlanPrototypeModel.Name = core.StringPtr("my-policy-plan") + backupPolicyPlanPrototypeModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} - // Enable retries and test again - vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.CreateBackupPolicyPlan(createBackupPolicyPlanOptionsModel) + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN model + backupPolicyScopePrototypeModel := new(vpcv1.BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN) + backupPolicyScopePrototypeModel.CRN = core.StringPtr("crn:v1:bluemix:public:enterprise::a/123456::enterprise:ebc2b430240943458b9e91e1432cfcce") + + // Construct an instance of the BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype model + backupPolicyPrototypeModel := new(vpcv1.BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype) + backupPolicyPrototypeModel.MatchUserTags = []string{"my-daily-backup-policy"} + backupPolicyPrototypeModel.Name = core.StringPtr("my-backup-policy") + backupPolicyPrototypeModel.Plans = []vpcv1.BackupPolicyPlanPrototype{*backupPolicyPlanPrototypeModel} + backupPolicyPrototypeModel.ResourceGroup = resourceGroupIdentityModel + backupPolicyPrototypeModel.Scope = backupPolicyScopePrototypeModel + backupPolicyPrototypeModel.MatchResourceType = core.StringPtr("volume") + + // Construct an instance of the CreateBackupPolicyOptions model + createBackupPolicyOptionsModel := new(vpcv1.CreateBackupPolicyOptions) + createBackupPolicyOptionsModel.BackupPolicyPrototype = backupPolicyPrototypeModel + createBackupPolicyOptionsModel.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.CreateBackupPolicy(createBackupPolicyOptionsModel) + 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.CreateBackupPolicy(createBackupPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -39318,16 +39593,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateBackupPolicyPlan(createBackupPolicyPlanOptions *CreateBackupPolicyPlanOptions)`, func() { + Describe(`CreateBackupPolicy(createBackupPolicyOptions *CreateBackupPolicyOptions)`, func() { version := "testString" - createBackupPolicyPlanPath := "/backup_policies/testString/plans" + createBackupPolicyPath := "/backup_policies" 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(createBackupPolicyPlanPath)) + Expect(req.URL.EscapedPath()).To(Equal(createBackupPolicyPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -39354,10 +39629,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"active": true, "attach_user_tags": ["AttachUserTags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_user_tags": ["MatchUserTags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/123456::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "fee82deba12e4c0fb69c3b09d1f12345", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}`) })) }) - It(`Invoke CreateBackupPolicyPlan successfully with retries`, func() { + It(`Invoke CreateBackupPolicy successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -39395,29 +39670,49 @@ var _ = Describe(`VpcV1`, func() { backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel - // Construct an instance of the CreateBackupPolicyPlanOptions model - createBackupPolicyPlanOptionsModel := new(vpcv1.CreateBackupPolicyPlanOptions) - createBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - createBackupPolicyPlanOptionsModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - createBackupPolicyPlanOptionsModel.Active = core.BoolPtr(true) - createBackupPolicyPlanOptionsModel.AttachUserTags = []string{"my-daily-backup-plan"} - createBackupPolicyPlanOptionsModel.ClonePolicy = backupPolicyPlanClonePolicyPrototypeModel - createBackupPolicyPlanOptionsModel.CopyUserTags = core.BoolPtr(true) - createBackupPolicyPlanOptionsModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel - createBackupPolicyPlanOptionsModel.Name = core.StringPtr("my-policy-plan") - createBackupPolicyPlanOptionsModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} - createBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the BackupPolicyPlanPrototype model + backupPolicyPlanPrototypeModel := new(vpcv1.BackupPolicyPlanPrototype) + backupPolicyPlanPrototypeModel.Active = core.BoolPtr(true) + backupPolicyPlanPrototypeModel.AttachUserTags = []string{"my-daily-backup-plan"} + backupPolicyPlanPrototypeModel.ClonePolicy = backupPolicyPlanClonePolicyPrototypeModel + backupPolicyPlanPrototypeModel.CopyUserTags = core.BoolPtr(true) + backupPolicyPlanPrototypeModel.CronSpec = core.StringPtr("30 */2 * * 1-5") + backupPolicyPlanPrototypeModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel + backupPolicyPlanPrototypeModel.Name = core.StringPtr("my-policy-plan") + backupPolicyPlanPrototypeModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN model + backupPolicyScopePrototypeModel := new(vpcv1.BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN) + backupPolicyScopePrototypeModel.CRN = core.StringPtr("crn:v1:bluemix:public:enterprise::a/123456::enterprise:ebc2b430240943458b9e91e1432cfcce") + + // Construct an instance of the BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype model + backupPolicyPrototypeModel := new(vpcv1.BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype) + backupPolicyPrototypeModel.MatchUserTags = []string{"my-daily-backup-policy"} + backupPolicyPrototypeModel.Name = core.StringPtr("my-backup-policy") + backupPolicyPrototypeModel.Plans = []vpcv1.BackupPolicyPlanPrototype{*backupPolicyPlanPrototypeModel} + backupPolicyPrototypeModel.ResourceGroup = resourceGroupIdentityModel + backupPolicyPrototypeModel.Scope = backupPolicyScopePrototypeModel + backupPolicyPrototypeModel.MatchResourceType = core.StringPtr("volume") + + // Construct an instance of the CreateBackupPolicyOptions model + createBackupPolicyOptionsModel := new(vpcv1.CreateBackupPolicyOptions) + createBackupPolicyOptionsModel.BackupPolicyPrototype = backupPolicyPrototypeModel + createBackupPolicyOptionsModel.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.CreateBackupPolicyPlanWithContext(ctx, createBackupPolicyPlanOptionsModel) + _, _, operationErr := vpcService.CreateBackupPolicyWithContext(ctx, createBackupPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateBackupPolicyPlan(createBackupPolicyPlanOptionsModel) + result, response, operationErr := vpcService.CreateBackupPolicy(createBackupPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -39425,7 +39720,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreateBackupPolicyPlanWithContext(ctx, createBackupPolicyPlanOptionsModel) + _, _, operationErr = vpcService.CreateBackupPolicyWithContext(ctx, createBackupPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -39439,7 +39734,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createBackupPolicyPlanPath)) + Expect(req.URL.EscapedPath()).To(Equal(createBackupPolicyPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -39463,10 +39758,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"active": true, "attach_user_tags": ["AttachUserTags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_user_tags": ["MatchUserTags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/123456::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "fee82deba12e4c0fb69c3b09d1f12345", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}`) })) }) - It(`Invoke CreateBackupPolicyPlan successfully`, func() { + It(`Invoke CreateBackupPolicy successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -39476,7 +39771,7 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreateBackupPolicyPlan(nil) + result, response, operationErr := vpcService.CreateBackupPolicy(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -39509,27 +39804,47 @@ var _ = Describe(`VpcV1`, func() { backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel - // Construct an instance of the CreateBackupPolicyPlanOptions model - createBackupPolicyPlanOptionsModel := new(vpcv1.CreateBackupPolicyPlanOptions) - createBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - createBackupPolicyPlanOptionsModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - createBackupPolicyPlanOptionsModel.Active = core.BoolPtr(true) - createBackupPolicyPlanOptionsModel.AttachUserTags = []string{"my-daily-backup-plan"} - createBackupPolicyPlanOptionsModel.ClonePolicy = backupPolicyPlanClonePolicyPrototypeModel - createBackupPolicyPlanOptionsModel.CopyUserTags = core.BoolPtr(true) - createBackupPolicyPlanOptionsModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel - createBackupPolicyPlanOptionsModel.Name = core.StringPtr("my-policy-plan") - createBackupPolicyPlanOptionsModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} - createBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the BackupPolicyPlanPrototype model + backupPolicyPlanPrototypeModel := new(vpcv1.BackupPolicyPlanPrototype) + backupPolicyPlanPrototypeModel.Active = core.BoolPtr(true) + backupPolicyPlanPrototypeModel.AttachUserTags = []string{"my-daily-backup-plan"} + backupPolicyPlanPrototypeModel.ClonePolicy = backupPolicyPlanClonePolicyPrototypeModel + backupPolicyPlanPrototypeModel.CopyUserTags = core.BoolPtr(true) + backupPolicyPlanPrototypeModel.CronSpec = core.StringPtr("30 */2 * * 1-5") + backupPolicyPlanPrototypeModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel + backupPolicyPlanPrototypeModel.Name = core.StringPtr("my-policy-plan") + backupPolicyPlanPrototypeModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN model + backupPolicyScopePrototypeModel := new(vpcv1.BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN) + backupPolicyScopePrototypeModel.CRN = core.StringPtr("crn:v1:bluemix:public:enterprise::a/123456::enterprise:ebc2b430240943458b9e91e1432cfcce") + + // Construct an instance of the BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype model + backupPolicyPrototypeModel := new(vpcv1.BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype) + backupPolicyPrototypeModel.MatchUserTags = []string{"my-daily-backup-policy"} + backupPolicyPrototypeModel.Name = core.StringPtr("my-backup-policy") + backupPolicyPrototypeModel.Plans = []vpcv1.BackupPolicyPlanPrototype{*backupPolicyPlanPrototypeModel} + backupPolicyPrototypeModel.ResourceGroup = resourceGroupIdentityModel + backupPolicyPrototypeModel.Scope = backupPolicyScopePrototypeModel + backupPolicyPrototypeModel.MatchResourceType = core.StringPtr("volume") + + // Construct an instance of the CreateBackupPolicyOptions model + createBackupPolicyOptionsModel := new(vpcv1.CreateBackupPolicyOptions) + createBackupPolicyOptionsModel.BackupPolicyPrototype = backupPolicyPrototypeModel + createBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateBackupPolicyPlan(createBackupPolicyPlanOptionsModel) + result, response, operationErr = vpcService.CreateBackupPolicy(createBackupPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateBackupPolicyPlan with error: Operation validation and request error`, func() { + It(`Invoke CreateBackupPolicy with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -39566,30 +39881,50 @@ var _ = Describe(`VpcV1`, func() { backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel - // Construct an instance of the CreateBackupPolicyPlanOptions model - createBackupPolicyPlanOptionsModel := new(vpcv1.CreateBackupPolicyPlanOptions) - createBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - createBackupPolicyPlanOptionsModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - createBackupPolicyPlanOptionsModel.Active = core.BoolPtr(true) - createBackupPolicyPlanOptionsModel.AttachUserTags = []string{"my-daily-backup-plan"} - createBackupPolicyPlanOptionsModel.ClonePolicy = backupPolicyPlanClonePolicyPrototypeModel - createBackupPolicyPlanOptionsModel.CopyUserTags = core.BoolPtr(true) - createBackupPolicyPlanOptionsModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel - createBackupPolicyPlanOptionsModel.Name = core.StringPtr("my-policy-plan") - createBackupPolicyPlanOptionsModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} - createBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the BackupPolicyPlanPrototype model + backupPolicyPlanPrototypeModel := new(vpcv1.BackupPolicyPlanPrototype) + backupPolicyPlanPrototypeModel.Active = core.BoolPtr(true) + backupPolicyPlanPrototypeModel.AttachUserTags = []string{"my-daily-backup-plan"} + backupPolicyPlanPrototypeModel.ClonePolicy = backupPolicyPlanClonePolicyPrototypeModel + backupPolicyPlanPrototypeModel.CopyUserTags = core.BoolPtr(true) + backupPolicyPlanPrototypeModel.CronSpec = core.StringPtr("30 */2 * * 1-5") + backupPolicyPlanPrototypeModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel + backupPolicyPlanPrototypeModel.Name = core.StringPtr("my-policy-plan") + backupPolicyPlanPrototypeModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN model + backupPolicyScopePrototypeModel := new(vpcv1.BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN) + backupPolicyScopePrototypeModel.CRN = core.StringPtr("crn:v1:bluemix:public:enterprise::a/123456::enterprise:ebc2b430240943458b9e91e1432cfcce") + + // Construct an instance of the BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype model + backupPolicyPrototypeModel := new(vpcv1.BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype) + backupPolicyPrototypeModel.MatchUserTags = []string{"my-daily-backup-policy"} + backupPolicyPrototypeModel.Name = core.StringPtr("my-backup-policy") + backupPolicyPrototypeModel.Plans = []vpcv1.BackupPolicyPlanPrototype{*backupPolicyPlanPrototypeModel} + backupPolicyPrototypeModel.ResourceGroup = resourceGroupIdentityModel + backupPolicyPrototypeModel.Scope = backupPolicyScopePrototypeModel + backupPolicyPrototypeModel.MatchResourceType = core.StringPtr("volume") + + // Construct an instance of the CreateBackupPolicyOptions model + createBackupPolicyOptionsModel := new(vpcv1.CreateBackupPolicyOptions) + createBackupPolicyOptionsModel.BackupPolicyPrototype = backupPolicyPrototypeModel + createBackupPolicyOptionsModel.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.CreateBackupPolicyPlan(createBackupPolicyPlanOptionsModel) + result, response, operationErr := vpcService.CreateBackupPolicy(createBackupPolicyOptionsModel) 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 CreateBackupPolicyPlanOptions model with no property values - createBackupPolicyPlanOptionsModelNew := new(vpcv1.CreateBackupPolicyPlanOptions) + // Construct a second instance of the CreateBackupPolicyOptions model with no property values + createBackupPolicyOptionsModelNew := new(vpcv1.CreateBackupPolicyOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateBackupPolicyPlan(createBackupPolicyPlanOptionsModelNew) + result, response, operationErr = vpcService.CreateBackupPolicy(createBackupPolicyOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -39607,7 +39942,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(201) })) }) - It(`Invoke CreateBackupPolicyPlan successfully`, func() { + It(`Invoke CreateBackupPolicy successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -39644,21 +39979,41 @@ var _ = Describe(`VpcV1`, func() { backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel - // Construct an instance of the CreateBackupPolicyPlanOptions model - createBackupPolicyPlanOptionsModel := new(vpcv1.CreateBackupPolicyPlanOptions) - createBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - createBackupPolicyPlanOptionsModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - createBackupPolicyPlanOptionsModel.Active = core.BoolPtr(true) - createBackupPolicyPlanOptionsModel.AttachUserTags = []string{"my-daily-backup-plan"} - createBackupPolicyPlanOptionsModel.ClonePolicy = backupPolicyPlanClonePolicyPrototypeModel - createBackupPolicyPlanOptionsModel.CopyUserTags = core.BoolPtr(true) - createBackupPolicyPlanOptionsModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel - createBackupPolicyPlanOptionsModel.Name = core.StringPtr("my-policy-plan") - createBackupPolicyPlanOptionsModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} - createBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the BackupPolicyPlanPrototype model + backupPolicyPlanPrototypeModel := new(vpcv1.BackupPolicyPlanPrototype) + backupPolicyPlanPrototypeModel.Active = core.BoolPtr(true) + backupPolicyPlanPrototypeModel.AttachUserTags = []string{"my-daily-backup-plan"} + backupPolicyPlanPrototypeModel.ClonePolicy = backupPolicyPlanClonePolicyPrototypeModel + backupPolicyPlanPrototypeModel.CopyUserTags = core.BoolPtr(true) + backupPolicyPlanPrototypeModel.CronSpec = core.StringPtr("30 */2 * * 1-5") + backupPolicyPlanPrototypeModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel + backupPolicyPlanPrototypeModel.Name = core.StringPtr("my-policy-plan") + backupPolicyPlanPrototypeModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN model + backupPolicyScopePrototypeModel := new(vpcv1.BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN) + backupPolicyScopePrototypeModel.CRN = core.StringPtr("crn:v1:bluemix:public:enterprise::a/123456::enterprise:ebc2b430240943458b9e91e1432cfcce") + + // Construct an instance of the BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype model + backupPolicyPrototypeModel := new(vpcv1.BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype) + backupPolicyPrototypeModel.MatchUserTags = []string{"my-daily-backup-policy"} + backupPolicyPrototypeModel.Name = core.StringPtr("my-backup-policy") + backupPolicyPrototypeModel.Plans = []vpcv1.BackupPolicyPlanPrototype{*backupPolicyPlanPrototypeModel} + backupPolicyPrototypeModel.ResourceGroup = resourceGroupIdentityModel + backupPolicyPrototypeModel.Scope = backupPolicyScopePrototypeModel + backupPolicyPrototypeModel.MatchResourceType = core.StringPtr("volume") + + // Construct an instance of the CreateBackupPolicyOptions model + createBackupPolicyOptionsModel := new(vpcv1.CreateBackupPolicyOptions) + createBackupPolicyOptionsModel.BackupPolicyPrototype = backupPolicyPrototypeModel + createBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.CreateBackupPolicyPlan(createBackupPolicyPlanOptionsModel) + result, response, operationErr := vpcService.CreateBackupPolicy(createBackupPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -39670,27 +40025,33 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions) - Operation response error`, func() { + Describe(`ListBackupPolicyJobs(listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions) - Operation response error`, func() { version := "testString" - deleteBackupPolicyPlanPath := "/backup_policies/testString/plans/testString" + listBackupPolicyJobsPath := "/backup_policies/testString/jobs" 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(deleteBackupPolicyPlanPath)) - 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.EscapedPath()).To(Equal(listBackupPolicyJobsPath)) + 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()["status"]).To(Equal([]string{"failed"})) + Expect(req.URL.Query()["backup_policy_plan.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) + Expect(req.URL.Query()["source.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["target_snapshots[].id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["target_snapshots[].crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263"})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke DeleteBackupPolicyPlan with error: Operation response processing error`, func() { + It(`Invoke ListBackupPolicyJobs with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -39699,21 +40060,27 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteBackupPolicyPlanOptions model - deleteBackupPolicyPlanOptionsModel := new(vpcv1.DeleteBackupPolicyPlanOptions) - deleteBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - deleteBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") - deleteBackupPolicyPlanOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - deleteBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBackupPolicyJobsOptions model + listBackupPolicyJobsOptionsModel := new(vpcv1.ListBackupPolicyJobsOptions) + listBackupPolicyJobsOptionsModel.BackupPolicyID = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.Status = core.StringPtr("failed") + listBackupPolicyJobsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.Start = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBackupPolicyJobsOptionsModel.Sort = core.StringPtr("name") + listBackupPolicyJobsOptionsModel.SourceID = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.TargetSnapshotsID = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.TargetSnapshotsCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263") + listBackupPolicyJobsOptionsModel.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.DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptionsModel) + result, response, operationErr := vpcService.ListBackupPolicyJobs(listBackupPolicyJobsOptionsModel) 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.DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptionsModel) + result, response, operationErr = vpcService.ListBackupPolicyJobs(listBackupPolicyJobsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -39723,32 +40090,38 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions)`, func() { + Describe(`ListBackupPolicyJobs(listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions)`, func() { version := "testString" - deleteBackupPolicyPlanPath := "/backup_policies/testString/plans/testString" + listBackupPolicyJobsPath := "/backup_policies/testString/jobs" 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(deleteBackupPolicyPlanPath)) - Expect(req.Method).To(Equal("DELETE")) + Expect(req.URL.EscapedPath()).To(Equal(listBackupPolicyJobsPath)) + Expect(req.Method).To(Equal("GET")) - 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))})) + Expect(req.URL.Query()["status"]).To(Equal([]string{"failed"})) + Expect(req.URL.Query()["backup_policy_plan.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) + Expect(req.URL.Query()["source.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["target_snapshots[].id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["target_snapshots[].crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263"})) // 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(202) - fmt.Fprintf(res, "%s", `{"active": true, "attach_user_tags": ["AttachUserTags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/7241e2a8-601f-11ea-8503-000c29475bed/jobs?limit=20"}, "jobs": [{"auto_delete": true, "auto_delete_after": 90, "backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/0fe9e5d8-0a4d-4818-96ec-e99708644a58/jobs/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "job_type": "creation", "resource_type": "backup_policy_job", "source": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "status": "failed", "status_reasons": [{"code": "source_volume_busy", "message": "Message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshooting-backup-for-vpc"}], "target_snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/7241e2a8-601f-11ea-8503-000c29475bed/jobss?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) })) }) - It(`Invoke DeleteBackupPolicyPlan successfully with retries`, func() { + It(`Invoke ListBackupPolicyJobs successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -39758,23 +40131,29 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the DeleteBackupPolicyPlanOptions model - deleteBackupPolicyPlanOptionsModel := new(vpcv1.DeleteBackupPolicyPlanOptions) - deleteBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - deleteBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") - deleteBackupPolicyPlanOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - deleteBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBackupPolicyJobsOptions model + listBackupPolicyJobsOptionsModel := new(vpcv1.ListBackupPolicyJobsOptions) + listBackupPolicyJobsOptionsModel.BackupPolicyID = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.Status = core.StringPtr("failed") + listBackupPolicyJobsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.Start = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBackupPolicyJobsOptionsModel.Sort = core.StringPtr("name") + listBackupPolicyJobsOptionsModel.SourceID = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.TargetSnapshotsID = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.TargetSnapshotsCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263") + listBackupPolicyJobsOptionsModel.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.DeleteBackupPolicyPlanWithContext(ctx, deleteBackupPolicyPlanOptionsModel) + _, _, operationErr := vpcService.ListBackupPolicyJobsWithContext(ctx, listBackupPolicyJobsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptionsModel) + result, response, operationErr := vpcService.ListBackupPolicyJobs(listBackupPolicyJobsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -39782,7 +40161,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.DeleteBackupPolicyPlanWithContext(ctx, deleteBackupPolicyPlanOptionsModel) + _, _, operationErr = vpcService.ListBackupPolicyJobsWithContext(ctx, listBackupPolicyJobsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -39796,20 +40175,26 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteBackupPolicyPlanPath)) - Expect(req.Method).To(Equal("DELETE")) + Expect(req.URL.EscapedPath()).To(Equal(listBackupPolicyJobsPath)) + Expect(req.Method).To(Equal("GET")) - 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))})) + Expect(req.URL.Query()["status"]).To(Equal([]string{"failed"})) + Expect(req.URL.Query()["backup_policy_plan.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) + Expect(req.URL.Query()["source.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["target_snapshots[].id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["target_snapshots[].crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263"})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) - fmt.Fprintf(res, "%s", `{"active": true, "attach_user_tags": ["AttachUserTags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/7241e2a8-601f-11ea-8503-000c29475bed/jobs?limit=20"}, "jobs": [{"auto_delete": true, "auto_delete_after": 90, "backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/0fe9e5d8-0a4d-4818-96ec-e99708644a58/jobs/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "job_type": "creation", "resource_type": "backup_policy_job", "source": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "status": "failed", "status_reasons": [{"code": "source_volume_busy", "message": "Message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshooting-backup-for-vpc"}], "target_snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/7241e2a8-601f-11ea-8503-000c29475bed/jobss?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) })) }) - It(`Invoke DeleteBackupPolicyPlan successfully`, func() { + It(`Invoke ListBackupPolicyJobs successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -39819,26 +40204,32 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.DeleteBackupPolicyPlan(nil) + result, response, operationErr := vpcService.ListBackupPolicyJobs(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the DeleteBackupPolicyPlanOptions model - deleteBackupPolicyPlanOptionsModel := new(vpcv1.DeleteBackupPolicyPlanOptions) - deleteBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - deleteBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") - deleteBackupPolicyPlanOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - deleteBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBackupPolicyJobsOptions model + listBackupPolicyJobsOptionsModel := new(vpcv1.ListBackupPolicyJobsOptions) + listBackupPolicyJobsOptionsModel.BackupPolicyID = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.Status = core.StringPtr("failed") + listBackupPolicyJobsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.Start = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBackupPolicyJobsOptionsModel.Sort = core.StringPtr("name") + listBackupPolicyJobsOptionsModel.SourceID = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.TargetSnapshotsID = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.TargetSnapshotsCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263") + listBackupPolicyJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptionsModel) + result, response, operationErr = vpcService.ListBackupPolicyJobs(listBackupPolicyJobsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke DeleteBackupPolicyPlan with error: Operation validation and request error`, func() { + It(`Invoke ListBackupPolicyJobs with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -39847,24 +40238,30 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteBackupPolicyPlanOptions model - deleteBackupPolicyPlanOptionsModel := new(vpcv1.DeleteBackupPolicyPlanOptions) - deleteBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - deleteBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") - deleteBackupPolicyPlanOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - deleteBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBackupPolicyJobsOptions model + listBackupPolicyJobsOptionsModel := new(vpcv1.ListBackupPolicyJobsOptions) + listBackupPolicyJobsOptionsModel.BackupPolicyID = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.Status = core.StringPtr("failed") + listBackupPolicyJobsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.Start = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBackupPolicyJobsOptionsModel.Sort = core.StringPtr("name") + listBackupPolicyJobsOptionsModel.SourceID = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.TargetSnapshotsID = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.TargetSnapshotsCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263") + listBackupPolicyJobsOptionsModel.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.DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptionsModel) + result, response, operationErr := vpcService.ListBackupPolicyJobs(listBackupPolicyJobsOptionsModel) 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 DeleteBackupPolicyPlanOptions model with no property values - deleteBackupPolicyPlanOptionsModelNew := new(vpcv1.DeleteBackupPolicyPlanOptions) + // Construct a second instance of the ListBackupPolicyJobsOptions model with no property values + listBackupPolicyJobsOptionsModelNew := new(vpcv1.ListBackupPolicyJobsOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptionsModelNew) + result, response, operationErr = vpcService.ListBackupPolicyJobs(listBackupPolicyJobsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -39879,10 +40276,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(202) + res.WriteHeader(200) })) }) - It(`Invoke DeleteBackupPolicyPlan successfully`, func() { + It(`Invoke ListBackupPolicyJobs successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -39891,15 +40288,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteBackupPolicyPlanOptions model - deleteBackupPolicyPlanOptionsModel := new(vpcv1.DeleteBackupPolicyPlanOptions) - deleteBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - deleteBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") - deleteBackupPolicyPlanOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - deleteBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBackupPolicyJobsOptions model + listBackupPolicyJobsOptionsModel := new(vpcv1.ListBackupPolicyJobsOptions) + listBackupPolicyJobsOptionsModel.BackupPolicyID = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.Status = core.StringPtr("failed") + listBackupPolicyJobsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.Start = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBackupPolicyJobsOptionsModel.Sort = core.StringPtr("name") + listBackupPolicyJobsOptionsModel.SourceID = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.TargetSnapshotsID = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.TargetSnapshotsCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263") + listBackupPolicyJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptionsModel) + result, response, operationErr := vpcService.ListBackupPolicyJobs(listBackupPolicyJobsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -39910,26 +40313,59 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) - }) - Describe(`GetBackupPolicyPlan(getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions) - Operation response error`, func() { - version := "testString" - getBackupPolicyPlanPath := "/backup_policies/testString/plans/testString" - Context(`Using mock server endpoint with invalid JSON response`, func() { + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(vpcv1.BackupPolicyJobCollection) + nextObject := new(vpcv1.BackupPolicyJobCollectionNext) + 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.BackupPolicyJobCollection) + + 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.BackupPolicyJobCollection) + nextObject := new(vpcv1.BackupPolicyJobCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { BeforeEach(func() { + var requestNumber int = 0 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(getBackupPolicyPlanPath)) + Expect(req.URL.EscapedPath()).To(Equal(listBackupPolicyJobsPath)) 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.Fprint(res, `} this is not valid json {`) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"jobs":[{"auto_delete":true,"auto_delete_after":90,"backup_policy_plan":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"completed_at":"2019-01-01T12:00:00.000Z","created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/0fe9e5d8-0a4d-4818-96ec-e99708644a58/jobs/4cf9171a-0043-4434-8727-15b53dbc374c","id":"4cf9171a-0043-4434-8727-15b53dbc374c","job_type":"creation","resource_type":"backup_policy_job","source":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"volume"},"status":"failed","status_reasons":[{"code":"source_volume_busy","message":"Message","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshooting-backup-for-vpc"}],"target_snapshots":[{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}]}],"limit":1}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"jobs":[{"auto_delete":true,"auto_delete_after":90,"backup_policy_plan":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"completed_at":"2019-01-01T12:00:00.000Z","created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/0fe9e5d8-0a4d-4818-96ec-e99708644a58/jobs/4cf9171a-0043-4434-8727-15b53dbc374c","id":"4cf9171a-0043-4434-8727-15b53dbc374c","job_type":"creation","resource_type":"backup_policy_job","source":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"volume"},"status":"failed","status_reasons":[{"code":"source_volume_busy","message":"Message","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshooting-backup-for-vpc"}],"target_snapshots":[{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}]}],"limit":1}`) + } else { + res.WriteHeader(400) + } })) }) - It(`Invoke GetBackupPolicyPlan with error: Operation response processing error`, func() { + It(`Use BackupPolicyJobsPager.GetNext successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -39938,39 +40374,121 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBackupPolicyPlanOptions model - getBackupPolicyPlanOptionsModel := new(vpcv1.GetBackupPolicyPlanOptions) - getBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - getBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") - getBackupPolicyPlanOptionsModel.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.GetBackupPolicyPlan(getBackupPolicyPlanOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) + listBackupPolicyJobsOptionsModel := &vpcv1.ListBackupPolicyJobsOptions{ + BackupPolicyID: core.StringPtr("testString"), + Status: core.StringPtr("failed"), + BackupPolicyPlanID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Sort: core.StringPtr("name"), + SourceID: core.StringPtr("testString"), + TargetSnapshotsID: core.StringPtr("testString"), + TargetSnapshotsCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263"), + } - // Enable retries and test again - vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetBackupPolicyPlan(getBackupPolicyPlanOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) + pager, err := vpcService.NewBackupPolicyJobsPager(listBackupPolicyJobsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.BackupPolicyJob + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) + }) + It(`Use BackupPolicyJobsPager.GetAll 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()) + + listBackupPolicyJobsOptionsModel := &vpcv1.ListBackupPolicyJobsOptions{ + BackupPolicyID: core.StringPtr("testString"), + Status: core.StringPtr("failed"), + BackupPolicyPlanID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Sort: core.StringPtr("name"), + SourceID: core.StringPtr("testString"), + TargetSnapshotsID: core.StringPtr("testString"), + TargetSnapshotsCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263"), + } + + pager, err := vpcService.NewBackupPolicyJobsPager(listBackupPolicyJobsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) + }) + }) + }) + Describe(`GetBackupPolicyJob(getBackupPolicyJobOptions *GetBackupPolicyJobOptions) - Operation response error`, func() { + version := "testString" + getBackupPolicyJobPath := "/backup_policies/testString/jobs/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(getBackupPolicyJobPath)) + 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 GetBackupPolicyJob 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 GetBackupPolicyJobOptions model + getBackupPolicyJobOptionsModel := new(vpcv1.GetBackupPolicyJobOptions) + getBackupPolicyJobOptionsModel.BackupPolicyID = core.StringPtr("testString") + getBackupPolicyJobOptionsModel.ID = core.StringPtr("testString") + getBackupPolicyJobOptionsModel.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.GetBackupPolicyJob(getBackupPolicyJobOptionsModel) + 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.GetBackupPolicyJob(getBackupPolicyJobOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`GetBackupPolicyPlan(getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions)`, func() { + Describe(`GetBackupPolicyJob(getBackupPolicyJobOptions *GetBackupPolicyJobOptions)`, func() { version := "testString" - getBackupPolicyPlanPath := "/backup_policies/testString/plans/testString" + getBackupPolicyJobPath := "/backup_policies/testString/jobs/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(getBackupPolicyPlanPath)) + Expect(req.URL.EscapedPath()).To(Equal(getBackupPolicyJobPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -39981,10 +40499,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"active": true, "attach_user_tags": ["AttachUserTags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}`) + fmt.Fprintf(res, "%s", `{"auto_delete": true, "auto_delete_after": 90, "backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/0fe9e5d8-0a4d-4818-96ec-e99708644a58/jobs/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "job_type": "creation", "resource_type": "backup_policy_job", "source": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "status": "failed", "status_reasons": [{"code": "source_volume_busy", "message": "Message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshooting-backup-for-vpc"}], "target_snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}`) })) }) - It(`Invoke GetBackupPolicyPlan successfully with retries`, func() { + It(`Invoke GetBackupPolicyJob successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -39994,22 +40512,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetBackupPolicyPlanOptions model - getBackupPolicyPlanOptionsModel := new(vpcv1.GetBackupPolicyPlanOptions) - getBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - getBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") - getBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBackupPolicyJobOptions model + getBackupPolicyJobOptionsModel := new(vpcv1.GetBackupPolicyJobOptions) + getBackupPolicyJobOptionsModel.BackupPolicyID = core.StringPtr("testString") + getBackupPolicyJobOptionsModel.ID = core.StringPtr("testString") + getBackupPolicyJobOptionsModel.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.GetBackupPolicyPlanWithContext(ctx, getBackupPolicyPlanOptionsModel) + _, _, operationErr := vpcService.GetBackupPolicyJobWithContext(ctx, getBackupPolicyJobOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetBackupPolicyPlan(getBackupPolicyPlanOptionsModel) + result, response, operationErr := vpcService.GetBackupPolicyJob(getBackupPolicyJobOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -40017,7 +40535,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetBackupPolicyPlanWithContext(ctx, getBackupPolicyPlanOptionsModel) + _, _, operationErr = vpcService.GetBackupPolicyJobWithContext(ctx, getBackupPolicyJobOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -40031,7 +40549,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBackupPolicyPlanPath)) + Expect(req.URL.EscapedPath()).To(Equal(getBackupPolicyJobPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -40039,10 +40557,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"active": true, "attach_user_tags": ["AttachUserTags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}`) + fmt.Fprintf(res, "%s", `{"auto_delete": true, "auto_delete_after": 90, "backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "completed_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/0fe9e5d8-0a4d-4818-96ec-e99708644a58/jobs/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "job_type": "creation", "resource_type": "backup_policy_job", "source": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "status": "failed", "status_reasons": [{"code": "source_volume_busy", "message": "Message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshooting-backup-for-vpc"}], "target_snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}`) })) }) - It(`Invoke GetBackupPolicyPlan successfully`, func() { + It(`Invoke GetBackupPolicyJob successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -40052,25 +40570,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetBackupPolicyPlan(nil) + result, response, operationErr := vpcService.GetBackupPolicyJob(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetBackupPolicyPlanOptions model - getBackupPolicyPlanOptionsModel := new(vpcv1.GetBackupPolicyPlanOptions) - getBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - getBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") - getBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBackupPolicyJobOptions model + getBackupPolicyJobOptionsModel := new(vpcv1.GetBackupPolicyJobOptions) + getBackupPolicyJobOptionsModel.BackupPolicyID = core.StringPtr("testString") + getBackupPolicyJobOptionsModel.ID = core.StringPtr("testString") + getBackupPolicyJobOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetBackupPolicyPlan(getBackupPolicyPlanOptionsModel) + result, response, operationErr = vpcService.GetBackupPolicyJob(getBackupPolicyJobOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetBackupPolicyPlan with error: Operation validation and request error`, func() { + It(`Invoke GetBackupPolicyJob with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -40079,23 +40597,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBackupPolicyPlanOptions model - getBackupPolicyPlanOptionsModel := new(vpcv1.GetBackupPolicyPlanOptions) - getBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - getBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") - getBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBackupPolicyJobOptions model + getBackupPolicyJobOptionsModel := new(vpcv1.GetBackupPolicyJobOptions) + getBackupPolicyJobOptionsModel.BackupPolicyID = core.StringPtr("testString") + getBackupPolicyJobOptionsModel.ID = core.StringPtr("testString") + getBackupPolicyJobOptionsModel.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.GetBackupPolicyPlan(getBackupPolicyPlanOptionsModel) + result, response, operationErr := vpcService.GetBackupPolicyJob(getBackupPolicyJobOptionsModel) 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 GetBackupPolicyPlanOptions model with no property values - getBackupPolicyPlanOptionsModelNew := new(vpcv1.GetBackupPolicyPlanOptions) + // Construct a second instance of the GetBackupPolicyJobOptions model with no property values + getBackupPolicyJobOptionsModelNew := new(vpcv1.GetBackupPolicyJobOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetBackupPolicyPlan(getBackupPolicyPlanOptionsModelNew) + result, response, operationErr = vpcService.GetBackupPolicyJob(getBackupPolicyJobOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -40113,7 +40631,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetBackupPolicyPlan successfully`, func() { + It(`Invoke GetBackupPolicyJob successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -40122,14 +40640,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBackupPolicyPlanOptions model - getBackupPolicyPlanOptionsModel := new(vpcv1.GetBackupPolicyPlanOptions) - getBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - getBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") - getBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBackupPolicyJobOptions model + getBackupPolicyJobOptionsModel := new(vpcv1.GetBackupPolicyJobOptions) + getBackupPolicyJobOptionsModel.BackupPolicyID = core.StringPtr("testString") + getBackupPolicyJobOptionsModel.ID = core.StringPtr("testString") + getBackupPolicyJobOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetBackupPolicyPlan(getBackupPolicyPlanOptionsModel) + result, response, operationErr := vpcService.GetBackupPolicyJob(getBackupPolicyJobOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -40141,27 +40659,26 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateBackupPolicyPlan(updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions) - Operation response error`, func() { + Describe(`ListBackupPolicyPlans(listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) - Operation response error`, func() { version := "testString" - updateBackupPolicyPlanPath := "/backup_policies/testString/plans/testString" + listBackupPolicyPlansPath := "/backup_policies/testString/plans" 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(updateBackupPolicyPlanPath)) - 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.EscapedPath()).To(Equal(listBackupPolicyPlansPath)) + 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"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateBackupPolicyPlan with error: Operation response processing error`, func() { + It(`Invoke ListBackupPolicyPlans with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -40170,63 +40687,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the BackupPolicyPlanClonePolicyPatch model - backupPolicyPlanClonePolicyPatchModel := new(vpcv1.BackupPolicyPlanClonePolicyPatch) - backupPolicyPlanClonePolicyPatchModel.MaxSnapshots = core.Int64Ptr(int64(1)) - backupPolicyPlanClonePolicyPatchModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} - - // Construct an instance of the BackupPolicyPlanDeletionTriggerPatch model - backupPolicyPlanDeletionTriggerPatchModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPatch) - backupPolicyPlanDeletionTriggerPatchModel.DeleteAfter = core.Int64Ptr(int64(20)) - backupPolicyPlanDeletionTriggerPatchModel.DeleteOverCount = core.Int64Ptr(int64(1)) - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the RegionIdentityByName model - regionIdentityModel := new(vpcv1.RegionIdentityByName) - regionIdentityModel.Name = core.StringPtr("us-south") - - // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model - backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel - backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel - - // Construct an instance of the BackupPolicyPlanPatch model - backupPolicyPlanPatchModel := new(vpcv1.BackupPolicyPlanPatch) - backupPolicyPlanPatchModel.Active = core.BoolPtr(true) - backupPolicyPlanPatchModel.AttachUserTags = []string{"my-daily-backup-plan"} - backupPolicyPlanPatchModel.ClonePolicy = backupPolicyPlanClonePolicyPatchModel - backupPolicyPlanPatchModel.CopyUserTags = core.BoolPtr(true) - backupPolicyPlanPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - backupPolicyPlanPatchModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPatchModel - backupPolicyPlanPatchModel.Name = core.StringPtr("my-policy-plan") - backupPolicyPlanPatchModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} - backupPolicyPlanPatchModelAsPatch, asPatchErr := backupPolicyPlanPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateBackupPolicyPlanOptions model - updateBackupPolicyPlanOptionsModel := new(vpcv1.UpdateBackupPolicyPlanOptions) - updateBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - updateBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") - updateBackupPolicyPlanOptionsModel.BackupPolicyPlanPatch = backupPolicyPlanPatchModelAsPatch - updateBackupPolicyPlanOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBackupPolicyPlansOptions model + listBackupPolicyPlansOptionsModel := new(vpcv1.ListBackupPolicyPlansOptions) + listBackupPolicyPlansOptionsModel.BackupPolicyID = core.StringPtr("testString") + listBackupPolicyPlansOptionsModel.Name = core.StringPtr("testString") + listBackupPolicyPlansOptionsModel.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.UpdateBackupPolicyPlan(updateBackupPolicyPlanOptionsModel) + result, response, operationErr := vpcService.ListBackupPolicyPlans(listBackupPolicyPlansOptionsModel) 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.UpdateBackupPolicyPlan(updateBackupPolicyPlanOptionsModel) + result, response, operationErr = vpcService.ListBackupPolicyPlans(listBackupPolicyPlansOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -40236,48 +40710,31 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateBackupPolicyPlan(updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions)`, func() { + Describe(`ListBackupPolicyPlans(listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions)`, func() { version := "testString" - updateBackupPolicyPlanPath := "/backup_policies/testString/plans/testString" + listBackupPolicyPlansPath := "/backup_policies/testString/plans" 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(updateBackupPolicyPlanPath)) - 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.EscapedPath()).To(Equal(listBackupPolicyPlansPath)) + Expect(req.Method).To(Equal("GET")) - 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))})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) // 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", `{"active": true, "attach_user_tags": ["AttachUserTags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}`) + fmt.Fprintf(res, "%s", `{"plans": [{"active": true, "attach_user_tags": ["AttachUserTags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}]}`) })) }) - It(`Invoke UpdateBackupPolicyPlan successfully with retries`, func() { + It(`Invoke ListBackupPolicyPlans successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -40287,65 +40744,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the BackupPolicyPlanClonePolicyPatch model - backupPolicyPlanClonePolicyPatchModel := new(vpcv1.BackupPolicyPlanClonePolicyPatch) - backupPolicyPlanClonePolicyPatchModel.MaxSnapshots = core.Int64Ptr(int64(1)) - backupPolicyPlanClonePolicyPatchModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} - - // Construct an instance of the BackupPolicyPlanDeletionTriggerPatch model - backupPolicyPlanDeletionTriggerPatchModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPatch) - backupPolicyPlanDeletionTriggerPatchModel.DeleteAfter = core.Int64Ptr(int64(20)) - backupPolicyPlanDeletionTriggerPatchModel.DeleteOverCount = core.Int64Ptr(int64(1)) - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the RegionIdentityByName model - regionIdentityModel := new(vpcv1.RegionIdentityByName) - regionIdentityModel.Name = core.StringPtr("us-south") - - // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model - backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel - backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel - - // Construct an instance of the BackupPolicyPlanPatch model - backupPolicyPlanPatchModel := new(vpcv1.BackupPolicyPlanPatch) - backupPolicyPlanPatchModel.Active = core.BoolPtr(true) - backupPolicyPlanPatchModel.AttachUserTags = []string{"my-daily-backup-plan"} - backupPolicyPlanPatchModel.ClonePolicy = backupPolicyPlanClonePolicyPatchModel - backupPolicyPlanPatchModel.CopyUserTags = core.BoolPtr(true) - backupPolicyPlanPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - backupPolicyPlanPatchModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPatchModel - backupPolicyPlanPatchModel.Name = core.StringPtr("my-policy-plan") - backupPolicyPlanPatchModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} - backupPolicyPlanPatchModelAsPatch, asPatchErr := backupPolicyPlanPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateBackupPolicyPlanOptions model - updateBackupPolicyPlanOptionsModel := new(vpcv1.UpdateBackupPolicyPlanOptions) - updateBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - updateBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") - updateBackupPolicyPlanOptionsModel.BackupPolicyPlanPatch = backupPolicyPlanPatchModelAsPatch - updateBackupPolicyPlanOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBackupPolicyPlansOptions model + listBackupPolicyPlansOptionsModel := new(vpcv1.ListBackupPolicyPlansOptions) + listBackupPolicyPlansOptionsModel.BackupPolicyID = core.StringPtr("testString") + listBackupPolicyPlansOptionsModel.Name = core.StringPtr("testString") + listBackupPolicyPlansOptionsModel.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.UpdateBackupPolicyPlanWithContext(ctx, updateBackupPolicyPlanOptionsModel) + _, _, operationErr := vpcService.ListBackupPolicyPlansWithContext(ctx, listBackupPolicyPlansOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateBackupPolicyPlan(updateBackupPolicyPlanOptionsModel) + result, response, operationErr := vpcService.ListBackupPolicyPlans(listBackupPolicyPlansOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -40353,7 +40767,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateBackupPolicyPlanWithContext(ctx, updateBackupPolicyPlanOptionsModel) + _, _, operationErr = vpcService.ListBackupPolicyPlansWithContext(ctx, listBackupPolicyPlansOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -40367,36 +40781,19 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateBackupPolicyPlanPath)) - 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.EscapedPath()).To(Equal(listBackupPolicyPlansPath)) + Expect(req.Method).To(Equal("GET")) - 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))})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"active": true, "attach_user_tags": ["AttachUserTags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}`) + fmt.Fprintf(res, "%s", `{"plans": [{"active": true, "attach_user_tags": ["AttachUserTags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}]}`) })) }) - It(`Invoke UpdateBackupPolicyPlan successfully`, func() { + It(`Invoke ListBackupPolicyPlans successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -40406,68 +40803,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateBackupPolicyPlan(nil) + result, response, operationErr := vpcService.ListBackupPolicyPlans(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the BackupPolicyPlanClonePolicyPatch model - backupPolicyPlanClonePolicyPatchModel := new(vpcv1.BackupPolicyPlanClonePolicyPatch) - backupPolicyPlanClonePolicyPatchModel.MaxSnapshots = core.Int64Ptr(int64(1)) - backupPolicyPlanClonePolicyPatchModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} - - // Construct an instance of the BackupPolicyPlanDeletionTriggerPatch model - backupPolicyPlanDeletionTriggerPatchModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPatch) - backupPolicyPlanDeletionTriggerPatchModel.DeleteAfter = core.Int64Ptr(int64(20)) - backupPolicyPlanDeletionTriggerPatchModel.DeleteOverCount = core.Int64Ptr(int64(1)) - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the RegionIdentityByName model - regionIdentityModel := new(vpcv1.RegionIdentityByName) - regionIdentityModel.Name = core.StringPtr("us-south") - - // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model - backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel - backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel - - // Construct an instance of the BackupPolicyPlanPatch model - backupPolicyPlanPatchModel := new(vpcv1.BackupPolicyPlanPatch) - backupPolicyPlanPatchModel.Active = core.BoolPtr(true) - backupPolicyPlanPatchModel.AttachUserTags = []string{"my-daily-backup-plan"} - backupPolicyPlanPatchModel.ClonePolicy = backupPolicyPlanClonePolicyPatchModel - backupPolicyPlanPatchModel.CopyUserTags = core.BoolPtr(true) - backupPolicyPlanPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - backupPolicyPlanPatchModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPatchModel - backupPolicyPlanPatchModel.Name = core.StringPtr("my-policy-plan") - backupPolicyPlanPatchModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} - backupPolicyPlanPatchModelAsPatch, asPatchErr := backupPolicyPlanPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateBackupPolicyPlanOptions model - updateBackupPolicyPlanOptionsModel := new(vpcv1.UpdateBackupPolicyPlanOptions) - updateBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - updateBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") - updateBackupPolicyPlanOptionsModel.BackupPolicyPlanPatch = backupPolicyPlanPatchModelAsPatch - updateBackupPolicyPlanOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBackupPolicyPlansOptions model + listBackupPolicyPlansOptionsModel := new(vpcv1.ListBackupPolicyPlansOptions) + listBackupPolicyPlansOptionsModel.BackupPolicyID = core.StringPtr("testString") + listBackupPolicyPlansOptionsModel.Name = core.StringPtr("testString") + listBackupPolicyPlansOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateBackupPolicyPlan(updateBackupPolicyPlanOptionsModel) + result, response, operationErr = vpcService.ListBackupPolicyPlans(listBackupPolicyPlansOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateBackupPolicyPlan with error: Operation validation and request error`, func() { + It(`Invoke ListBackupPolicyPlans with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -40476,66 +40830,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the BackupPolicyPlanClonePolicyPatch model - backupPolicyPlanClonePolicyPatchModel := new(vpcv1.BackupPolicyPlanClonePolicyPatch) - backupPolicyPlanClonePolicyPatchModel.MaxSnapshots = core.Int64Ptr(int64(1)) - backupPolicyPlanClonePolicyPatchModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} - - // Construct an instance of the BackupPolicyPlanDeletionTriggerPatch model - backupPolicyPlanDeletionTriggerPatchModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPatch) - backupPolicyPlanDeletionTriggerPatchModel.DeleteAfter = core.Int64Ptr(int64(20)) - backupPolicyPlanDeletionTriggerPatchModel.DeleteOverCount = core.Int64Ptr(int64(1)) - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the RegionIdentityByName model - regionIdentityModel := new(vpcv1.RegionIdentityByName) - regionIdentityModel.Name = core.StringPtr("us-south") - - // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model - backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel - backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel - - // Construct an instance of the BackupPolicyPlanPatch model - backupPolicyPlanPatchModel := new(vpcv1.BackupPolicyPlanPatch) - backupPolicyPlanPatchModel.Active = core.BoolPtr(true) - backupPolicyPlanPatchModel.AttachUserTags = []string{"my-daily-backup-plan"} - backupPolicyPlanPatchModel.ClonePolicy = backupPolicyPlanClonePolicyPatchModel - backupPolicyPlanPatchModel.CopyUserTags = core.BoolPtr(true) - backupPolicyPlanPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - backupPolicyPlanPatchModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPatchModel - backupPolicyPlanPatchModel.Name = core.StringPtr("my-policy-plan") - backupPolicyPlanPatchModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} - backupPolicyPlanPatchModelAsPatch, asPatchErr := backupPolicyPlanPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateBackupPolicyPlanOptions model - updateBackupPolicyPlanOptionsModel := new(vpcv1.UpdateBackupPolicyPlanOptions) - updateBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - updateBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") - updateBackupPolicyPlanOptionsModel.BackupPolicyPlanPatch = backupPolicyPlanPatchModelAsPatch - updateBackupPolicyPlanOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBackupPolicyPlansOptions model + listBackupPolicyPlansOptionsModel := new(vpcv1.ListBackupPolicyPlansOptions) + listBackupPolicyPlansOptionsModel.BackupPolicyID = core.StringPtr("testString") + listBackupPolicyPlansOptionsModel.Name = core.StringPtr("testString") + listBackupPolicyPlansOptionsModel.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.UpdateBackupPolicyPlan(updateBackupPolicyPlanOptionsModel) + result, response, operationErr := vpcService.ListBackupPolicyPlans(listBackupPolicyPlansOptionsModel) 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 UpdateBackupPolicyPlanOptions model with no property values - updateBackupPolicyPlanOptionsModelNew := new(vpcv1.UpdateBackupPolicyPlanOptions) + // Construct a second instance of the ListBackupPolicyPlansOptions model with no property values + listBackupPolicyPlansOptionsModelNew := new(vpcv1.ListBackupPolicyPlansOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateBackupPolicyPlan(updateBackupPolicyPlanOptionsModelNew) + result, response, operationErr = vpcService.ListBackupPolicyPlans(listBackupPolicyPlansOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -40553,7 +40864,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateBackupPolicyPlan successfully`, func() { + It(`Invoke ListBackupPolicyPlans successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -40562,59 +40873,16 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the BackupPolicyPlanClonePolicyPatch model - backupPolicyPlanClonePolicyPatchModel := new(vpcv1.BackupPolicyPlanClonePolicyPatch) - backupPolicyPlanClonePolicyPatchModel.MaxSnapshots = core.Int64Ptr(int64(1)) - backupPolicyPlanClonePolicyPatchModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} - - // Construct an instance of the BackupPolicyPlanDeletionTriggerPatch model - backupPolicyPlanDeletionTriggerPatchModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPatch) - backupPolicyPlanDeletionTriggerPatchModel.DeleteAfter = core.Int64Ptr(int64(20)) - backupPolicyPlanDeletionTriggerPatchModel.DeleteOverCount = core.Int64Ptr(int64(1)) - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + // Construct an instance of the ListBackupPolicyPlansOptions model + listBackupPolicyPlansOptionsModel := new(vpcv1.ListBackupPolicyPlansOptions) + listBackupPolicyPlansOptionsModel.BackupPolicyID = core.StringPtr("testString") + listBackupPolicyPlansOptionsModel.Name = core.StringPtr("testString") + listBackupPolicyPlansOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Construct an instance of the RegionIdentityByName model - regionIdentityModel := new(vpcv1.RegionIdentityByName) - regionIdentityModel.Name = core.StringPtr("us-south") - - // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model - backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) - backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel - backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel - - // Construct an instance of the BackupPolicyPlanPatch model - backupPolicyPlanPatchModel := new(vpcv1.BackupPolicyPlanPatch) - backupPolicyPlanPatchModel.Active = core.BoolPtr(true) - backupPolicyPlanPatchModel.AttachUserTags = []string{"my-daily-backup-plan"} - backupPolicyPlanPatchModel.ClonePolicy = backupPolicyPlanClonePolicyPatchModel - backupPolicyPlanPatchModel.CopyUserTags = core.BoolPtr(true) - backupPolicyPlanPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - backupPolicyPlanPatchModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPatchModel - backupPolicyPlanPatchModel.Name = core.StringPtr("my-policy-plan") - backupPolicyPlanPatchModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} - backupPolicyPlanPatchModelAsPatch, asPatchErr := backupPolicyPlanPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateBackupPolicyPlanOptions model - updateBackupPolicyPlanOptionsModel := new(vpcv1.UpdateBackupPolicyPlanOptions) - updateBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - updateBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") - updateBackupPolicyPlanOptionsModel.BackupPolicyPlanPatch = backupPolicyPlanPatchModelAsPatch - updateBackupPolicyPlanOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.UpdateBackupPolicyPlan(updateBackupPolicyPlanOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) + // Invoke operation + result, response, operationErr := vpcService.ListBackupPolicyPlans(listBackupPolicyPlansOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) // Verify a nil result Expect(result).To(BeNil()) @@ -40624,27 +40892,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteBackupPolicy(deleteBackupPolicyOptions *DeleteBackupPolicyOptions) - Operation response error`, func() { + Describe(`CreateBackupPolicyPlan(createBackupPolicyPlanOptions *CreateBackupPolicyPlanOptions) - Operation response error`, func() { version := "testString" - deleteBackupPolicyPath := "/backup_policies/testString" + createBackupPolicyPlanPath := "/backup_policies/testString/plans" 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(deleteBackupPolicyPath)) - 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.EscapedPath()).To(Equal(createBackupPolicyPlanPath)) + 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(202) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke DeleteBackupPolicy with error: Operation response processing error`, func() { + It(`Invoke CreateBackupPolicyPlan with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -40653,20 +40919,55 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteBackupPolicyOptions model - deleteBackupPolicyOptionsModel := new(vpcv1.DeleteBackupPolicyOptions) - deleteBackupPolicyOptionsModel.ID = core.StringPtr("testString") - deleteBackupPolicyOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - deleteBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the BackupPolicyPlanClonePolicyPrototype model + backupPolicyPlanClonePolicyPrototypeModel := new(vpcv1.BackupPolicyPlanClonePolicyPrototype) + backupPolicyPlanClonePolicyPrototypeModel.MaxSnapshots = core.Int64Ptr(int64(5)) + backupPolicyPlanClonePolicyPrototypeModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} + + // Construct an instance of the BackupPolicyPlanDeletionTriggerPrototype model + backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the RegionIdentityByName model + regionIdentityModel := new(vpcv1.RegionIdentityByName) + regionIdentityModel.Name = core.StringPtr("us-south") + + // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model + backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel + backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel + + // Construct an instance of the CreateBackupPolicyPlanOptions model + createBackupPolicyPlanOptionsModel := new(vpcv1.CreateBackupPolicyPlanOptions) + createBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + createBackupPolicyPlanOptionsModel.CronSpec = core.StringPtr("30 */2 * * 1-5") + createBackupPolicyPlanOptionsModel.Active = core.BoolPtr(true) + createBackupPolicyPlanOptionsModel.AttachUserTags = []string{"my-daily-backup-plan"} + createBackupPolicyPlanOptionsModel.ClonePolicy = backupPolicyPlanClonePolicyPrototypeModel + createBackupPolicyPlanOptionsModel.CopyUserTags = core.BoolPtr(true) + createBackupPolicyPlanOptionsModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel + createBackupPolicyPlanOptionsModel.Name = core.StringPtr("my-policy-plan") + createBackupPolicyPlanOptionsModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} + createBackupPolicyPlanOptionsModel.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.DeleteBackupPolicy(deleteBackupPolicyOptionsModel) + result, response, operationErr := vpcService.CreateBackupPolicyPlan(createBackupPolicyPlanOptionsModel) 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.DeleteBackupPolicy(deleteBackupPolicyOptionsModel) + result, response, operationErr = vpcService.CreateBackupPolicyPlan(createBackupPolicyPlanOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -40676,20 +40977,34 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteBackupPolicy(deleteBackupPolicyOptions *DeleteBackupPolicyOptions)`, func() { + Describe(`CreateBackupPolicyPlan(createBackupPolicyPlanOptions *CreateBackupPolicyPlanOptions)`, func() { version := "testString" - deleteBackupPolicyPath := "/backup_policies/testString" + createBackupPolicyPlanPath := "/backup_policies/testString/plans" 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(deleteBackupPolicyPath)) - Expect(req.Method).To(Equal("DELETE")) + Expect(req.URL.EscapedPath()).To(Equal(createBackupPolicyPlanPath)) + 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.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 @@ -40697,11 +41012,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_user_tags": ["MatchUserTags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/123456::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "fee82deba12e4c0fb69c3b09d1f12345", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"active": true, "attach_user_tags": ["AttachUserTags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}`) })) }) - It(`Invoke DeleteBackupPolicy successfully with retries`, func() { + It(`Invoke CreateBackupPolicyPlan successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -40711,22 +41026,57 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the DeleteBackupPolicyOptions model - deleteBackupPolicyOptionsModel := new(vpcv1.DeleteBackupPolicyOptions) - deleteBackupPolicyOptionsModel.ID = core.StringPtr("testString") - deleteBackupPolicyOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - deleteBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the BackupPolicyPlanClonePolicyPrototype model + backupPolicyPlanClonePolicyPrototypeModel := new(vpcv1.BackupPolicyPlanClonePolicyPrototype) + backupPolicyPlanClonePolicyPrototypeModel.MaxSnapshots = core.Int64Ptr(int64(5)) + backupPolicyPlanClonePolicyPrototypeModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} + + // Construct an instance of the BackupPolicyPlanDeletionTriggerPrototype model + backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the RegionIdentityByName model + regionIdentityModel := new(vpcv1.RegionIdentityByName) + regionIdentityModel.Name = core.StringPtr("us-south") + + // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model + backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel + backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel + + // Construct an instance of the CreateBackupPolicyPlanOptions model + createBackupPolicyPlanOptionsModel := new(vpcv1.CreateBackupPolicyPlanOptions) + createBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + createBackupPolicyPlanOptionsModel.CronSpec = core.StringPtr("30 */2 * * 1-5") + createBackupPolicyPlanOptionsModel.Active = core.BoolPtr(true) + createBackupPolicyPlanOptionsModel.AttachUserTags = []string{"my-daily-backup-plan"} + createBackupPolicyPlanOptionsModel.ClonePolicy = backupPolicyPlanClonePolicyPrototypeModel + createBackupPolicyPlanOptionsModel.CopyUserTags = core.BoolPtr(true) + createBackupPolicyPlanOptionsModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel + createBackupPolicyPlanOptionsModel.Name = core.StringPtr("my-policy-plan") + createBackupPolicyPlanOptionsModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} + createBackupPolicyPlanOptionsModel.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.DeleteBackupPolicyWithContext(ctx, deleteBackupPolicyOptionsModel) + _, _, operationErr := vpcService.CreateBackupPolicyPlanWithContext(ctx, createBackupPolicyPlanOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.DeleteBackupPolicy(deleteBackupPolicyOptionsModel) + result, response, operationErr := vpcService.CreateBackupPolicyPlan(createBackupPolicyPlanOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -40734,7 +41084,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.DeleteBackupPolicyWithContext(ctx, deleteBackupPolicyOptionsModel) + _, _, operationErr = vpcService.CreateBackupPolicyPlanWithContext(ctx, createBackupPolicyPlanOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -40748,20 +41098,34 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteBackupPolicyPath)) - Expect(req.Method).To(Equal("DELETE")) + Expect(req.URL.EscapedPath()).To(Equal(createBackupPolicyPlanPath)) + 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.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(202) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_user_tags": ["MatchUserTags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/123456::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "fee82deba12e4c0fb69c3b09d1f12345", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"active": true, "attach_user_tags": ["AttachUserTags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}`) })) }) - It(`Invoke DeleteBackupPolicy successfully`, func() { + It(`Invoke CreateBackupPolicyPlan successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -40771,25 +41135,60 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.DeleteBackupPolicy(nil) + result, response, operationErr := vpcService.CreateBackupPolicyPlan(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the DeleteBackupPolicyOptions model - deleteBackupPolicyOptionsModel := new(vpcv1.DeleteBackupPolicyOptions) - deleteBackupPolicyOptionsModel.ID = core.StringPtr("testString") - deleteBackupPolicyOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - deleteBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the BackupPolicyPlanClonePolicyPrototype model + backupPolicyPlanClonePolicyPrototypeModel := new(vpcv1.BackupPolicyPlanClonePolicyPrototype) + backupPolicyPlanClonePolicyPrototypeModel.MaxSnapshots = core.Int64Ptr(int64(5)) + backupPolicyPlanClonePolicyPrototypeModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} + + // Construct an instance of the BackupPolicyPlanDeletionTriggerPrototype model + backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the RegionIdentityByName model + regionIdentityModel := new(vpcv1.RegionIdentityByName) + regionIdentityModel.Name = core.StringPtr("us-south") + + // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model + backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel + backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel + + // Construct an instance of the CreateBackupPolicyPlanOptions model + createBackupPolicyPlanOptionsModel := new(vpcv1.CreateBackupPolicyPlanOptions) + createBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + createBackupPolicyPlanOptionsModel.CronSpec = core.StringPtr("30 */2 * * 1-5") + createBackupPolicyPlanOptionsModel.Active = core.BoolPtr(true) + createBackupPolicyPlanOptionsModel.AttachUserTags = []string{"my-daily-backup-plan"} + createBackupPolicyPlanOptionsModel.ClonePolicy = backupPolicyPlanClonePolicyPrototypeModel + createBackupPolicyPlanOptionsModel.CopyUserTags = core.BoolPtr(true) + createBackupPolicyPlanOptionsModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel + createBackupPolicyPlanOptionsModel.Name = core.StringPtr("my-policy-plan") + createBackupPolicyPlanOptionsModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} + createBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.DeleteBackupPolicy(deleteBackupPolicyOptionsModel) + result, response, operationErr = vpcService.CreateBackupPolicyPlan(createBackupPolicyPlanOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke DeleteBackupPolicy with error: Operation validation and request error`, func() { + It(`Invoke CreateBackupPolicyPlan with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -40798,23 +41197,58 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteBackupPolicyOptions model - deleteBackupPolicyOptionsModel := new(vpcv1.DeleteBackupPolicyOptions) - deleteBackupPolicyOptionsModel.ID = core.StringPtr("testString") - deleteBackupPolicyOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - deleteBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the BackupPolicyPlanClonePolicyPrototype model + backupPolicyPlanClonePolicyPrototypeModel := new(vpcv1.BackupPolicyPlanClonePolicyPrototype) + backupPolicyPlanClonePolicyPrototypeModel.MaxSnapshots = core.Int64Ptr(int64(5)) + backupPolicyPlanClonePolicyPrototypeModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} + + // Construct an instance of the BackupPolicyPlanDeletionTriggerPrototype model + backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the RegionIdentityByName model + regionIdentityModel := new(vpcv1.RegionIdentityByName) + regionIdentityModel.Name = core.StringPtr("us-south") + + // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model + backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel + backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel + + // Construct an instance of the CreateBackupPolicyPlanOptions model + createBackupPolicyPlanOptionsModel := new(vpcv1.CreateBackupPolicyPlanOptions) + createBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + createBackupPolicyPlanOptionsModel.CronSpec = core.StringPtr("30 */2 * * 1-5") + createBackupPolicyPlanOptionsModel.Active = core.BoolPtr(true) + createBackupPolicyPlanOptionsModel.AttachUserTags = []string{"my-daily-backup-plan"} + createBackupPolicyPlanOptionsModel.ClonePolicy = backupPolicyPlanClonePolicyPrototypeModel + createBackupPolicyPlanOptionsModel.CopyUserTags = core.BoolPtr(true) + createBackupPolicyPlanOptionsModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel + createBackupPolicyPlanOptionsModel.Name = core.StringPtr("my-policy-plan") + createBackupPolicyPlanOptionsModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} + createBackupPolicyPlanOptionsModel.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.DeleteBackupPolicy(deleteBackupPolicyOptionsModel) + result, response, operationErr := vpcService.CreateBackupPolicyPlan(createBackupPolicyPlanOptionsModel) 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 DeleteBackupPolicyOptions model with no property values - deleteBackupPolicyOptionsModelNew := new(vpcv1.DeleteBackupPolicyOptions) + // Construct a second instance of the CreateBackupPolicyPlanOptions model with no property values + createBackupPolicyPlanOptionsModelNew := new(vpcv1.CreateBackupPolicyPlanOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.DeleteBackupPolicy(deleteBackupPolicyOptionsModelNew) + result, response, operationErr = vpcService.CreateBackupPolicyPlan(createBackupPolicyPlanOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -40829,10 +41263,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(202) + res.WriteHeader(201) })) }) - It(`Invoke DeleteBackupPolicy successfully`, func() { + It(`Invoke CreateBackupPolicyPlan successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -40841,14 +41275,49 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteBackupPolicyOptions model - deleteBackupPolicyOptionsModel := new(vpcv1.DeleteBackupPolicyOptions) - deleteBackupPolicyOptionsModel.ID = core.StringPtr("testString") - deleteBackupPolicyOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - deleteBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the BackupPolicyPlanClonePolicyPrototype model + backupPolicyPlanClonePolicyPrototypeModel := new(vpcv1.BackupPolicyPlanClonePolicyPrototype) + backupPolicyPlanClonePolicyPrototypeModel.MaxSnapshots = core.Int64Ptr(int64(5)) + backupPolicyPlanClonePolicyPrototypeModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} + + // Construct an instance of the BackupPolicyPlanDeletionTriggerPrototype model + backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the RegionIdentityByName model + regionIdentityModel := new(vpcv1.RegionIdentityByName) + regionIdentityModel.Name = core.StringPtr("us-south") + + // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model + backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel + backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel + + // Construct an instance of the CreateBackupPolicyPlanOptions model + createBackupPolicyPlanOptionsModel := new(vpcv1.CreateBackupPolicyPlanOptions) + createBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + createBackupPolicyPlanOptionsModel.CronSpec = core.StringPtr("30 */2 * * 1-5") + createBackupPolicyPlanOptionsModel.Active = core.BoolPtr(true) + createBackupPolicyPlanOptionsModel.AttachUserTags = []string{"my-daily-backup-plan"} + createBackupPolicyPlanOptionsModel.ClonePolicy = backupPolicyPlanClonePolicyPrototypeModel + createBackupPolicyPlanOptionsModel.CopyUserTags = core.BoolPtr(true) + createBackupPolicyPlanOptionsModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel + createBackupPolicyPlanOptionsModel.Name = core.StringPtr("my-policy-plan") + createBackupPolicyPlanOptionsModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} + createBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.DeleteBackupPolicy(deleteBackupPolicyOptionsModel) + result, response, operationErr := vpcService.CreateBackupPolicyPlan(createBackupPolicyPlanOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -40860,25 +41329,27 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetBackupPolicy(getBackupPolicyOptions *GetBackupPolicyOptions) - Operation response error`, func() { + Describe(`DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions) - Operation response error`, func() { version := "testString" - getBackupPolicyPath := "/backup_policies/testString" + deleteBackupPolicyPlanPath := "/backup_policies/testString/plans/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(getBackupPolicyPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deleteBackupPolicyPlanPath)) + 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.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(202) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetBackupPolicy with error: Operation response processing error`, func() { + It(`Invoke DeleteBackupPolicyPlan with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -40887,19 +41358,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBackupPolicyOptions model - getBackupPolicyOptionsModel := new(vpcv1.GetBackupPolicyOptions) - getBackupPolicyOptionsModel.ID = core.StringPtr("testString") - getBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteBackupPolicyPlanOptions model + deleteBackupPolicyPlanOptionsModel := new(vpcv1.DeleteBackupPolicyPlanOptions) + deleteBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + deleteBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") + deleteBackupPolicyPlanOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + deleteBackupPolicyPlanOptionsModel.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.GetBackupPolicy(getBackupPolicyOptionsModel) + result, response, operationErr := vpcService.DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptionsModel) 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.GetBackupPolicy(getBackupPolicyOptionsModel) + result, response, operationErr = vpcService.DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -40909,18 +41382,20 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetBackupPolicy(getBackupPolicyOptions *GetBackupPolicyOptions)`, func() { + Describe(`DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions)`, func() { version := "testString" - getBackupPolicyPath := "/backup_policies/testString" + deleteBackupPolicyPlanPath := "/backup_policies/testString/plans/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(getBackupPolicyPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deleteBackupPolicyPlanPath)) + 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))})) // Sleep a short time to support a timeout test @@ -40928,11 +41403,11 @@ 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::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_user_tags": ["MatchUserTags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/123456::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "fee82deba12e4c0fb69c3b09d1f12345", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}`) + res.WriteHeader(202) + fmt.Fprintf(res, "%s", `{"active": true, "attach_user_tags": ["AttachUserTags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}`) })) }) - It(`Invoke GetBackupPolicy successfully with retries`, func() { + It(`Invoke DeleteBackupPolicyPlan successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -40942,21 +41417,23 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetBackupPolicyOptions model - getBackupPolicyOptionsModel := new(vpcv1.GetBackupPolicyOptions) - getBackupPolicyOptionsModel.ID = core.StringPtr("testString") - getBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteBackupPolicyPlanOptions model + deleteBackupPolicyPlanOptionsModel := new(vpcv1.DeleteBackupPolicyPlanOptions) + deleteBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + deleteBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") + deleteBackupPolicyPlanOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + deleteBackupPolicyPlanOptionsModel.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.GetBackupPolicyWithContext(ctx, getBackupPolicyOptionsModel) + _, _, operationErr := vpcService.DeleteBackupPolicyPlanWithContext(ctx, deleteBackupPolicyPlanOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetBackupPolicy(getBackupPolicyOptionsModel) + result, response, operationErr := vpcService.DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -40964,7 +41441,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetBackupPolicyWithContext(ctx, getBackupPolicyOptionsModel) + _, _, operationErr = vpcService.DeleteBackupPolicyPlanWithContext(ctx, deleteBackupPolicyPlanOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -40978,18 +41455,20 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBackupPolicyPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deleteBackupPolicyPlanPath)) + 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))})) // 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::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_user_tags": ["MatchUserTags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/123456::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "fee82deba12e4c0fb69c3b09d1f12345", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}`) + res.WriteHeader(202) + fmt.Fprintf(res, "%s", `{"active": true, "attach_user_tags": ["AttachUserTags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}`) })) }) - It(`Invoke GetBackupPolicy successfully`, func() { + It(`Invoke DeleteBackupPolicyPlan successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -40999,24 +41478,26 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetBackupPolicy(nil) + result, response, operationErr := vpcService.DeleteBackupPolicyPlan(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetBackupPolicyOptions model - getBackupPolicyOptionsModel := new(vpcv1.GetBackupPolicyOptions) - getBackupPolicyOptionsModel.ID = core.StringPtr("testString") - getBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteBackupPolicyPlanOptions model + deleteBackupPolicyPlanOptionsModel := new(vpcv1.DeleteBackupPolicyPlanOptions) + deleteBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + deleteBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") + deleteBackupPolicyPlanOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + deleteBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetBackupPolicy(getBackupPolicyOptionsModel) + result, response, operationErr = vpcService.DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetBackupPolicy with error: Operation validation and request error`, func() { + It(`Invoke DeleteBackupPolicyPlan with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -41025,22 +41506,24 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBackupPolicyOptions model - getBackupPolicyOptionsModel := new(vpcv1.GetBackupPolicyOptions) - getBackupPolicyOptionsModel.ID = core.StringPtr("testString") - getBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteBackupPolicyPlanOptions model + deleteBackupPolicyPlanOptionsModel := new(vpcv1.DeleteBackupPolicyPlanOptions) + deleteBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + deleteBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") + deleteBackupPolicyPlanOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + deleteBackupPolicyPlanOptionsModel.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.GetBackupPolicy(getBackupPolicyOptionsModel) + result, response, operationErr := vpcService.DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptionsModel) 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 GetBackupPolicyOptions model with no property values - getBackupPolicyOptionsModelNew := new(vpcv1.GetBackupPolicyOptions) + // Construct a second instance of the DeleteBackupPolicyPlanOptions model with no property values + deleteBackupPolicyPlanOptionsModelNew := new(vpcv1.DeleteBackupPolicyPlanOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetBackupPolicy(getBackupPolicyOptionsModelNew) + result, response, operationErr = vpcService.DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -41055,10 +41538,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(202) })) }) - It(`Invoke GetBackupPolicy successfully`, func() { + It(`Invoke DeleteBackupPolicyPlan successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -41067,13 +41550,15 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBackupPolicyOptions model - getBackupPolicyOptionsModel := new(vpcv1.GetBackupPolicyOptions) - getBackupPolicyOptionsModel.ID = core.StringPtr("testString") - getBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteBackupPolicyPlanOptions model + deleteBackupPolicyPlanOptionsModel := new(vpcv1.DeleteBackupPolicyPlanOptions) + deleteBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + deleteBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") + deleteBackupPolicyPlanOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + deleteBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetBackupPolicy(getBackupPolicyOptionsModel) + result, response, operationErr := vpcService.DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -41085,19 +41570,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateBackupPolicy(updateBackupPolicyOptions *UpdateBackupPolicyOptions) - Operation response error`, func() { + Describe(`GetBackupPolicyPlan(getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions) - Operation response error`, func() { version := "testString" - updateBackupPolicyPath := "/backup_policies/testString" + getBackupPolicyPlanPath := "/backup_policies/testString/plans/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(updateBackupPolicyPath)) - 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.EscapedPath()).To(Equal(getBackupPolicyPlanPath)) + 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") @@ -41105,7 +41588,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateBackupPolicy with error: Operation response processing error`, func() { + It(`Invoke GetBackupPolicyPlan with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -41114,29 +41597,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the BackupPolicyPatch model - backupPolicyPatchModel := new(vpcv1.BackupPolicyPatch) - backupPolicyPatchModel.IncludedContent = []string{"data_volumes"} - backupPolicyPatchModel.MatchUserTags = []string{"my-daily-backup-policy"} - backupPolicyPatchModel.Name = core.StringPtr("my-backup-policy") - backupPolicyPatchModelAsPatch, asPatchErr := backupPolicyPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateBackupPolicyOptions model - updateBackupPolicyOptionsModel := new(vpcv1.UpdateBackupPolicyOptions) - updateBackupPolicyOptionsModel.ID = core.StringPtr("testString") - updateBackupPolicyOptionsModel.BackupPolicyPatch = backupPolicyPatchModelAsPatch - updateBackupPolicyOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBackupPolicyPlanOptions model + getBackupPolicyPlanOptionsModel := new(vpcv1.GetBackupPolicyPlanOptions) + getBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + getBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") + getBackupPolicyPlanOptionsModel.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.UpdateBackupPolicy(updateBackupPolicyOptionsModel) + result, response, operationErr := vpcService.GetBackupPolicyPlan(getBackupPolicyPlanOptionsModel) 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.UpdateBackupPolicy(updateBackupPolicyOptionsModel) + result, response, operationErr = vpcService.GetBackupPolicyPlan(getBackupPolicyPlanOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -41146,36 +41620,18 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateBackupPolicy(updateBackupPolicyOptions *UpdateBackupPolicyOptions)`, func() { + Describe(`GetBackupPolicyPlan(getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions)`, func() { version := "testString" - updateBackupPolicyPath := "/backup_policies/testString" + getBackupPolicyPlanPath := "/backup_policies/testString/plans/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(updateBackupPolicyPath)) - 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.EscapedPath()).To(Equal(getBackupPolicyPlanPath)) + Expect(req.Method).To(Equal("GET")) - 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 @@ -41184,10 +41640,10 @@ 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::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_user_tags": ["MatchUserTags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/123456::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "fee82deba12e4c0fb69c3b09d1f12345", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}`) + fmt.Fprintf(res, "%s", `{"active": true, "attach_user_tags": ["AttachUserTags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}`) })) }) - It(`Invoke UpdateBackupPolicy successfully with retries`, func() { + It(`Invoke GetBackupPolicyPlan successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -41197,31 +41653,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the BackupPolicyPatch model - backupPolicyPatchModel := new(vpcv1.BackupPolicyPatch) - backupPolicyPatchModel.IncludedContent = []string{"data_volumes"} - backupPolicyPatchModel.MatchUserTags = []string{"my-daily-backup-policy"} - backupPolicyPatchModel.Name = core.StringPtr("my-backup-policy") - backupPolicyPatchModelAsPatch, asPatchErr := backupPolicyPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateBackupPolicyOptions model - updateBackupPolicyOptionsModel := new(vpcv1.UpdateBackupPolicyOptions) - updateBackupPolicyOptionsModel.ID = core.StringPtr("testString") - updateBackupPolicyOptionsModel.BackupPolicyPatch = backupPolicyPatchModelAsPatch - updateBackupPolicyOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBackupPolicyPlanOptions model + getBackupPolicyPlanOptionsModel := new(vpcv1.GetBackupPolicyPlanOptions) + getBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + getBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") + getBackupPolicyPlanOptionsModel.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.UpdateBackupPolicyWithContext(ctx, updateBackupPolicyOptionsModel) + _, _, operationErr := vpcService.GetBackupPolicyPlanWithContext(ctx, getBackupPolicyPlanOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateBackupPolicy(updateBackupPolicyOptionsModel) + result, response, operationErr := vpcService.GetBackupPolicyPlan(getBackupPolicyPlanOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -41229,7 +41676,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateBackupPolicyWithContext(ctx, updateBackupPolicyOptionsModel) + _, _, operationErr = vpcService.GetBackupPolicyPlanWithContext(ctx, getBackupPolicyPlanOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -41243,36 +41690,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateBackupPolicyPath)) - 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.EscapedPath()).To(Equal(getBackupPolicyPlanPath)) + Expect(req.Method).To(Equal("GET")) - 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", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_user_tags": ["MatchUserTags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/123456::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "fee82deba12e4c0fb69c3b09d1f12345", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}`) + fmt.Fprintf(res, "%s", `{"active": true, "attach_user_tags": ["AttachUserTags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}`) })) }) - It(`Invoke UpdateBackupPolicy successfully`, func() { + It(`Invoke GetBackupPolicyPlan successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -41282,34 +41711,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateBackupPolicy(nil) + result, response, operationErr := vpcService.GetBackupPolicyPlan(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the BackupPolicyPatch model - backupPolicyPatchModel := new(vpcv1.BackupPolicyPatch) - backupPolicyPatchModel.IncludedContent = []string{"data_volumes"} - backupPolicyPatchModel.MatchUserTags = []string{"my-daily-backup-policy"} - backupPolicyPatchModel.Name = core.StringPtr("my-backup-policy") - backupPolicyPatchModelAsPatch, asPatchErr := backupPolicyPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateBackupPolicyOptions model - updateBackupPolicyOptionsModel := new(vpcv1.UpdateBackupPolicyOptions) - updateBackupPolicyOptionsModel.ID = core.StringPtr("testString") - updateBackupPolicyOptionsModel.BackupPolicyPatch = backupPolicyPatchModelAsPatch - updateBackupPolicyOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBackupPolicyPlanOptions model + getBackupPolicyPlanOptionsModel := new(vpcv1.GetBackupPolicyPlanOptions) + getBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + getBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") + getBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateBackupPolicy(updateBackupPolicyOptionsModel) + result, response, operationErr = vpcService.GetBackupPolicyPlan(getBackupPolicyPlanOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateBackupPolicy with error: Operation validation and request error`, func() { + It(`Invoke GetBackupPolicyPlan with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -41318,32 +41738,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the BackupPolicyPatch model - backupPolicyPatchModel := new(vpcv1.BackupPolicyPatch) - backupPolicyPatchModel.IncludedContent = []string{"data_volumes"} - backupPolicyPatchModel.MatchUserTags = []string{"my-daily-backup-policy"} - backupPolicyPatchModel.Name = core.StringPtr("my-backup-policy") - backupPolicyPatchModelAsPatch, asPatchErr := backupPolicyPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateBackupPolicyOptions model - updateBackupPolicyOptionsModel := new(vpcv1.UpdateBackupPolicyOptions) - updateBackupPolicyOptionsModel.ID = core.StringPtr("testString") - updateBackupPolicyOptionsModel.BackupPolicyPatch = backupPolicyPatchModelAsPatch - updateBackupPolicyOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBackupPolicyPlanOptions model + getBackupPolicyPlanOptionsModel := new(vpcv1.GetBackupPolicyPlanOptions) + getBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + getBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") + getBackupPolicyPlanOptionsModel.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.UpdateBackupPolicy(updateBackupPolicyOptionsModel) + result, response, operationErr := vpcService.GetBackupPolicyPlan(getBackupPolicyPlanOptionsModel) 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 UpdateBackupPolicyOptions model with no property values - updateBackupPolicyOptionsModelNew := new(vpcv1.UpdateBackupPolicyOptions) + // Construct a second instance of the GetBackupPolicyPlanOptions model with no property values + getBackupPolicyPlanOptionsModelNew := new(vpcv1.GetBackupPolicyPlanOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateBackupPolicy(updateBackupPolicyOptionsModelNew) + result, response, operationErr = vpcService.GetBackupPolicyPlan(getBackupPolicyPlanOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -41361,7 +41772,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateBackupPolicy successfully`, func() { + It(`Invoke GetBackupPolicyPlan successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -41370,23 +41781,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the BackupPolicyPatch model - backupPolicyPatchModel := new(vpcv1.BackupPolicyPatch) - backupPolicyPatchModel.IncludedContent = []string{"data_volumes"} - backupPolicyPatchModel.MatchUserTags = []string{"my-daily-backup-policy"} - backupPolicyPatchModel.Name = core.StringPtr("my-backup-policy") - backupPolicyPatchModelAsPatch, asPatchErr := backupPolicyPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateBackupPolicyOptions model - updateBackupPolicyOptionsModel := new(vpcv1.UpdateBackupPolicyOptions) - updateBackupPolicyOptionsModel.ID = core.StringPtr("testString") - updateBackupPolicyOptionsModel.BackupPolicyPatch = backupPolicyPatchModelAsPatch - updateBackupPolicyOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBackupPolicyPlanOptions model + getBackupPolicyPlanOptionsModel := new(vpcv1.GetBackupPolicyPlanOptions) + getBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + getBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") + getBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.UpdateBackupPolicy(updateBackupPolicyOptionsModel) + result, response, operationErr := vpcService.GetBackupPolicyPlan(getBackupPolicyPlanOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -41398,27 +41800,27 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListPlacementGroups(listPlacementGroupsOptions *ListPlacementGroupsOptions) - Operation response error`, func() { + Describe(`UpdateBackupPolicyPlan(updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions) - Operation response error`, func() { version := "testString" - listPlacementGroupsPath := "/placement_groups" + updateBackupPolicyPlanPath := "/backup_policies/testString/plans/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(listPlacementGroupsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateBackupPolicyPlanPath)) + 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))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListPlacementGroups with error: Operation response processing error`, func() { + It(`Invoke UpdateBackupPolicyPlan with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -41427,20 +41829,63 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListPlacementGroupsOptions model - listPlacementGroupsOptionsModel := new(vpcv1.ListPlacementGroupsOptions) - listPlacementGroupsOptionsModel.Start = core.StringPtr("testString") - listPlacementGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listPlacementGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the BackupPolicyPlanClonePolicyPatch model + backupPolicyPlanClonePolicyPatchModel := new(vpcv1.BackupPolicyPlanClonePolicyPatch) + backupPolicyPlanClonePolicyPatchModel.MaxSnapshots = core.Int64Ptr(int64(1)) + backupPolicyPlanClonePolicyPatchModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} + + // Construct an instance of the BackupPolicyPlanDeletionTriggerPatch model + backupPolicyPlanDeletionTriggerPatchModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPatch) + backupPolicyPlanDeletionTriggerPatchModel.DeleteAfter = core.Int64Ptr(int64(20)) + backupPolicyPlanDeletionTriggerPatchModel.DeleteOverCount = core.Int64Ptr(int64(1)) + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the RegionIdentityByName model + regionIdentityModel := new(vpcv1.RegionIdentityByName) + regionIdentityModel.Name = core.StringPtr("us-south") + + // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model + backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel + backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel + + // Construct an instance of the BackupPolicyPlanPatch model + backupPolicyPlanPatchModel := new(vpcv1.BackupPolicyPlanPatch) + backupPolicyPlanPatchModel.Active = core.BoolPtr(true) + backupPolicyPlanPatchModel.AttachUserTags = []string{"my-daily-backup-plan"} + backupPolicyPlanPatchModel.ClonePolicy = backupPolicyPlanClonePolicyPatchModel + backupPolicyPlanPatchModel.CopyUserTags = core.BoolPtr(true) + backupPolicyPlanPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") + backupPolicyPlanPatchModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPatchModel + backupPolicyPlanPatchModel.Name = core.StringPtr("my-policy-plan") + backupPolicyPlanPatchModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} + backupPolicyPlanPatchModelAsPatch, asPatchErr := backupPolicyPlanPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateBackupPolicyPlanOptions model + updateBackupPolicyPlanOptionsModel := new(vpcv1.UpdateBackupPolicyPlanOptions) + updateBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + updateBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") + updateBackupPolicyPlanOptionsModel.BackupPolicyPlanPatch = backupPolicyPlanPatchModelAsPatch + updateBackupPolicyPlanOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateBackupPolicyPlanOptionsModel.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.ListPlacementGroups(listPlacementGroupsOptionsModel) + result, response, operationErr := vpcService.UpdateBackupPolicyPlan(updateBackupPolicyPlanOptionsModel) 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.ListPlacementGroups(listPlacementGroupsOptionsModel) + result, response, operationErr = vpcService.UpdateBackupPolicyPlan(updateBackupPolicyPlanOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -41450,32 +41895,48 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListPlacementGroups(listPlacementGroupsOptions *ListPlacementGroupsOptions)`, func() { + Describe(`UpdateBackupPolicyPlan(updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions)`, func() { version := "testString" - listPlacementGroupsPath := "/placement_groups" + updateBackupPolicyPlanPath := "/backup_policies/testString/plans/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(listPlacementGroupsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateBackupPolicyPlanPath)) + 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))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) // 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/placement_groups?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "placement_groups": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"active": true, "attach_user_tags": ["AttachUserTags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}`) })) }) - It(`Invoke ListPlacementGroups successfully with retries`, func() { + It(`Invoke UpdateBackupPolicyPlan successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -41485,22 +41946,65 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListPlacementGroupsOptions model - listPlacementGroupsOptionsModel := new(vpcv1.ListPlacementGroupsOptions) - listPlacementGroupsOptionsModel.Start = core.StringPtr("testString") - listPlacementGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listPlacementGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the BackupPolicyPlanClonePolicyPatch model + backupPolicyPlanClonePolicyPatchModel := new(vpcv1.BackupPolicyPlanClonePolicyPatch) + backupPolicyPlanClonePolicyPatchModel.MaxSnapshots = core.Int64Ptr(int64(1)) + backupPolicyPlanClonePolicyPatchModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} + + // Construct an instance of the BackupPolicyPlanDeletionTriggerPatch model + backupPolicyPlanDeletionTriggerPatchModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPatch) + backupPolicyPlanDeletionTriggerPatchModel.DeleteAfter = core.Int64Ptr(int64(20)) + backupPolicyPlanDeletionTriggerPatchModel.DeleteOverCount = core.Int64Ptr(int64(1)) + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the RegionIdentityByName model + regionIdentityModel := new(vpcv1.RegionIdentityByName) + regionIdentityModel.Name = core.StringPtr("us-south") + + // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model + backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel + backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel + + // Construct an instance of the BackupPolicyPlanPatch model + backupPolicyPlanPatchModel := new(vpcv1.BackupPolicyPlanPatch) + backupPolicyPlanPatchModel.Active = core.BoolPtr(true) + backupPolicyPlanPatchModel.AttachUserTags = []string{"my-daily-backup-plan"} + backupPolicyPlanPatchModel.ClonePolicy = backupPolicyPlanClonePolicyPatchModel + backupPolicyPlanPatchModel.CopyUserTags = core.BoolPtr(true) + backupPolicyPlanPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") + backupPolicyPlanPatchModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPatchModel + backupPolicyPlanPatchModel.Name = core.StringPtr("my-policy-plan") + backupPolicyPlanPatchModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} + backupPolicyPlanPatchModelAsPatch, asPatchErr := backupPolicyPlanPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateBackupPolicyPlanOptions model + updateBackupPolicyPlanOptionsModel := new(vpcv1.UpdateBackupPolicyPlanOptions) + updateBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + updateBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") + updateBackupPolicyPlanOptionsModel.BackupPolicyPlanPatch = backupPolicyPlanPatchModelAsPatch + updateBackupPolicyPlanOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateBackupPolicyPlanOptionsModel.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.ListPlacementGroupsWithContext(ctx, listPlacementGroupsOptionsModel) + _, _, operationErr := vpcService.UpdateBackupPolicyPlanWithContext(ctx, updateBackupPolicyPlanOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListPlacementGroups(listPlacementGroupsOptionsModel) + result, response, operationErr := vpcService.UpdateBackupPolicyPlan(updateBackupPolicyPlanOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -41508,7 +42012,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListPlacementGroupsWithContext(ctx, listPlacementGroupsOptionsModel) + _, _, operationErr = vpcService.UpdateBackupPolicyPlanWithContext(ctx, updateBackupPolicyPlanOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -41522,20 +42026,36 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listPlacementGroupsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateBackupPolicyPlanPath)) + 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))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) // 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/placement_groups?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "placement_groups": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"active": true, "attach_user_tags": ["AttachUserTags"], "clone_policy": {"max_snapshots": 1, "zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}]}, "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "30 */2 * * 1-5", "deletion_trigger": {"delete_after": 20, "delete_over_count": 20}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "lifecycle_state": "stable", "name": "my-policy-plan", "remote_region_policies": [{"delete_over_count": 1, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}], "resource_type": "backup_policy_plan"}`) })) }) - It(`Invoke ListPlacementGroups successfully`, func() { + It(`Invoke UpdateBackupPolicyPlan successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -41545,25 +42065,68 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListPlacementGroups(nil) + result, response, operationErr := vpcService.UpdateBackupPolicyPlan(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListPlacementGroupsOptions model - listPlacementGroupsOptionsModel := new(vpcv1.ListPlacementGroupsOptions) - listPlacementGroupsOptionsModel.Start = core.StringPtr("testString") - listPlacementGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listPlacementGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the BackupPolicyPlanClonePolicyPatch model + backupPolicyPlanClonePolicyPatchModel := new(vpcv1.BackupPolicyPlanClonePolicyPatch) + backupPolicyPlanClonePolicyPatchModel.MaxSnapshots = core.Int64Ptr(int64(1)) + backupPolicyPlanClonePolicyPatchModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} + + // Construct an instance of the BackupPolicyPlanDeletionTriggerPatch model + backupPolicyPlanDeletionTriggerPatchModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPatch) + backupPolicyPlanDeletionTriggerPatchModel.DeleteAfter = core.Int64Ptr(int64(20)) + backupPolicyPlanDeletionTriggerPatchModel.DeleteOverCount = core.Int64Ptr(int64(1)) + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the RegionIdentityByName model + regionIdentityModel := new(vpcv1.RegionIdentityByName) + regionIdentityModel.Name = core.StringPtr("us-south") + + // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model + backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel + backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel + + // Construct an instance of the BackupPolicyPlanPatch model + backupPolicyPlanPatchModel := new(vpcv1.BackupPolicyPlanPatch) + backupPolicyPlanPatchModel.Active = core.BoolPtr(true) + backupPolicyPlanPatchModel.AttachUserTags = []string{"my-daily-backup-plan"} + backupPolicyPlanPatchModel.ClonePolicy = backupPolicyPlanClonePolicyPatchModel + backupPolicyPlanPatchModel.CopyUserTags = core.BoolPtr(true) + backupPolicyPlanPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") + backupPolicyPlanPatchModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPatchModel + backupPolicyPlanPatchModel.Name = core.StringPtr("my-policy-plan") + backupPolicyPlanPatchModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} + backupPolicyPlanPatchModelAsPatch, asPatchErr := backupPolicyPlanPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateBackupPolicyPlanOptions model + updateBackupPolicyPlanOptionsModel := new(vpcv1.UpdateBackupPolicyPlanOptions) + updateBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + updateBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") + updateBackupPolicyPlanOptionsModel.BackupPolicyPlanPatch = backupPolicyPlanPatchModelAsPatch + updateBackupPolicyPlanOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListPlacementGroups(listPlacementGroupsOptionsModel) + result, response, operationErr = vpcService.UpdateBackupPolicyPlan(updateBackupPolicyPlanOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListPlacementGroups with error: Operation request error`, func() { + It(`Invoke UpdateBackupPolicyPlan with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -41572,19 +42135,69 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListPlacementGroupsOptions model - listPlacementGroupsOptionsModel := new(vpcv1.ListPlacementGroupsOptions) - listPlacementGroupsOptionsModel.Start = core.StringPtr("testString") - listPlacementGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listPlacementGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the BackupPolicyPlanClonePolicyPatch model + backupPolicyPlanClonePolicyPatchModel := new(vpcv1.BackupPolicyPlanClonePolicyPatch) + backupPolicyPlanClonePolicyPatchModel.MaxSnapshots = core.Int64Ptr(int64(1)) + backupPolicyPlanClonePolicyPatchModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} + + // Construct an instance of the BackupPolicyPlanDeletionTriggerPatch model + backupPolicyPlanDeletionTriggerPatchModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPatch) + backupPolicyPlanDeletionTriggerPatchModel.DeleteAfter = core.Int64Ptr(int64(20)) + backupPolicyPlanDeletionTriggerPatchModel.DeleteOverCount = core.Int64Ptr(int64(1)) + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the RegionIdentityByName model + regionIdentityModel := new(vpcv1.RegionIdentityByName) + regionIdentityModel.Name = core.StringPtr("us-south") + + // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model + backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel + backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel + + // Construct an instance of the BackupPolicyPlanPatch model + backupPolicyPlanPatchModel := new(vpcv1.BackupPolicyPlanPatch) + backupPolicyPlanPatchModel.Active = core.BoolPtr(true) + backupPolicyPlanPatchModel.AttachUserTags = []string{"my-daily-backup-plan"} + backupPolicyPlanPatchModel.ClonePolicy = backupPolicyPlanClonePolicyPatchModel + backupPolicyPlanPatchModel.CopyUserTags = core.BoolPtr(true) + backupPolicyPlanPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") + backupPolicyPlanPatchModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPatchModel + backupPolicyPlanPatchModel.Name = core.StringPtr("my-policy-plan") + backupPolicyPlanPatchModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} + backupPolicyPlanPatchModelAsPatch, asPatchErr := backupPolicyPlanPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateBackupPolicyPlanOptions model + updateBackupPolicyPlanOptionsModel := new(vpcv1.UpdateBackupPolicyPlanOptions) + updateBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + updateBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") + updateBackupPolicyPlanOptionsModel.BackupPolicyPlanPatch = backupPolicyPlanPatchModelAsPatch + updateBackupPolicyPlanOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateBackupPolicyPlanOptionsModel.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.ListPlacementGroups(listPlacementGroupsOptionsModel) + result, response, operationErr := vpcService.UpdateBackupPolicyPlan(updateBackupPolicyPlanOptionsModel) 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 UpdateBackupPolicyPlanOptions model with no property values + updateBackupPolicyPlanOptionsModelNew := new(vpcv1.UpdateBackupPolicyPlanOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateBackupPolicyPlan(updateBackupPolicyPlanOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -41599,7 +42212,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListPlacementGroups successfully`, func() { + It(`Invoke UpdateBackupPolicyPlan successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -41608,145 +42221,89 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListPlacementGroupsOptions model - listPlacementGroupsOptionsModel := new(vpcv1.ListPlacementGroupsOptions) - listPlacementGroupsOptionsModel.Start = core.StringPtr("testString") - listPlacementGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listPlacementGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Invoke operation - result, response, operationErr := vpcService.ListPlacementGroups(listPlacementGroupsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) + // Construct an instance of the BackupPolicyPlanClonePolicyPatch model + backupPolicyPlanClonePolicyPatchModel := new(vpcv1.BackupPolicyPlanClonePolicyPatch) + backupPolicyPlanClonePolicyPatchModel.MaxSnapshots = core.Int64Ptr(int64(1)) + backupPolicyPlanClonePolicyPatchModel.Zones = []vpcv1.ZoneIdentityIntf{zoneIdentityModel} - // 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.PlacementGroupCollection) - nextObject := new(vpcv1.PlacementGroupCollectionNext) - nextObject.Href = core.StringPtr("ibm.com?start=abc-123") - responseObject.Next = nextObject + // Construct an instance of the BackupPolicyPlanDeletionTriggerPatch model + backupPolicyPlanDeletionTriggerPatchModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPatch) + backupPolicyPlanDeletionTriggerPatchModel.DeleteAfter = core.Int64Ptr(int64(20)) + backupPolicyPlanDeletionTriggerPatchModel.DeleteOverCount = core.Int64Ptr(int64(1)) - 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.PlacementGroupCollection) + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - 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.PlacementGroupCollection) - nextObject := new(vpcv1.PlacementGroupCollectionNext) - nextObject.Href = core.StringPtr("ibm.com") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - }) - Context(`Using mock server endpoint - paginated response`, func() { - BeforeEach(func() { - var requestNumber int = 0 - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() + // Construct an instance of the RegionIdentityByName model + regionIdentityModel := new(vpcv1.RegionIdentityByName) + regionIdentityModel.Name = core.StringPtr("us-south") - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listPlacementGroupsPath)) - Expect(req.Method).To(Equal("GET")) + // Construct an instance of the BackupPolicyPlanRemoteRegionPolicyPrototype model + backupPolicyPlanRemoteRegionPolicyPrototypeModel := new(vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(5)) + backupPolicyPlanRemoteRegionPolicyPrototypeModel.EncryptionKey = encryptionKeyIdentityModel + backupPolicyPlanRemoteRegionPolicyPrototypeModel.Region = regionIdentityModel - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - requestNumber++ - if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"placement_groups":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871","href":"https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871","id":"r018-418fe842-a3e9-47b9-a938-1aa5bd632871","lifecycle_state":"stable","name":"my-placement-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"placement_group","strategy":"host_spread"}]}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"placement_groups":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871","href":"https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871","id":"r018-418fe842-a3e9-47b9-a938-1aa5bd632871","lifecycle_state":"stable","name":"my-placement-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"placement_group","strategy":"host_spread"}]}`) - } else { - res.WriteHeader(400) - } - })) - }) - It(`Use PlacementGroupsPager.GetNext 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 BackupPolicyPlanPatch model + backupPolicyPlanPatchModel := new(vpcv1.BackupPolicyPlanPatch) + backupPolicyPlanPatchModel.Active = core.BoolPtr(true) + backupPolicyPlanPatchModel.AttachUserTags = []string{"my-daily-backup-plan"} + backupPolicyPlanPatchModel.ClonePolicy = backupPolicyPlanClonePolicyPatchModel + backupPolicyPlanPatchModel.CopyUserTags = core.BoolPtr(true) + backupPolicyPlanPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") + backupPolicyPlanPatchModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPatchModel + backupPolicyPlanPatchModel.Name = core.StringPtr("my-policy-plan") + backupPolicyPlanPatchModel.RemoteRegionPolicies = []vpcv1.BackupPolicyPlanRemoteRegionPolicyPrototype{*backupPolicyPlanRemoteRegionPolicyPrototypeModel} + backupPolicyPlanPatchModelAsPatch, asPatchErr := backupPolicyPlanPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) - listPlacementGroupsOptionsModel := &vpcv1.ListPlacementGroupsOptions{ - Limit: core.Int64Ptr(int64(10)), - } + // Construct an instance of the UpdateBackupPolicyPlanOptions model + updateBackupPolicyPlanOptionsModel := new(vpcv1.UpdateBackupPolicyPlanOptions) + updateBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + updateBackupPolicyPlanOptionsModel.ID = core.StringPtr("testString") + updateBackupPolicyPlanOptionsModel.BackupPolicyPlanPatch = backupPolicyPlanPatchModelAsPatch + updateBackupPolicyPlanOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - pager, err := vpcService.NewPlacementGroupsPager(listPlacementGroupsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) + // Invoke operation + result, response, operationErr := vpcService.UpdateBackupPolicyPlan(updateBackupPolicyPlanOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) - var allResults []vpcv1.PlacementGroup - for pager.HasNext() { - nextPage, err := pager.GetNext() - Expect(err).To(BeNil()) - Expect(nextPage).ToNot(BeNil()) - allResults = append(allResults, nextPage...) - } - Expect(len(allResults)).To(Equal(2)) + // Verify a nil result + Expect(result).To(BeNil()) }) - It(`Use PlacementGroupsPager.GetAll 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()) - - listPlacementGroupsOptionsModel := &vpcv1.ListPlacementGroupsOptions{ - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewPlacementGroupsPager(listPlacementGroupsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - allResults, err := pager.GetAll() - Expect(err).To(BeNil()) - Expect(allResults).ToNot(BeNil()) - Expect(len(allResults)).To(Equal(2)) + AfterEach(func() { + testServer.Close() }) }) }) - Describe(`CreatePlacementGroup(createPlacementGroupOptions *CreatePlacementGroupOptions) - Operation response error`, func() { + Describe(`DeleteBackupPolicy(deleteBackupPolicyOptions *DeleteBackupPolicyOptions) - Operation response error`, func() { version := "testString" - createPlacementGroupPath := "/placement_groups" + deleteBackupPolicyPath := "/backup_policies/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(createPlacementGroupPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(deleteBackupPolicyPath)) + 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.Header().Set("Content-type", "application/json") - res.WriteHeader(201) + res.WriteHeader(202) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreatePlacementGroup with error: Operation response processing error`, func() { + It(`Invoke DeleteBackupPolicy with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -41755,25 +42312,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreatePlacementGroupOptions model - createPlacementGroupOptionsModel := new(vpcv1.CreatePlacementGroupOptions) - createPlacementGroupOptionsModel.Strategy = core.StringPtr("host_spread") - createPlacementGroupOptionsModel.Name = core.StringPtr("my-placement-group") - createPlacementGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel - createPlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteBackupPolicyOptions model + deleteBackupPolicyOptionsModel := new(vpcv1.DeleteBackupPolicyOptions) + deleteBackupPolicyOptionsModel.ID = core.StringPtr("testString") + deleteBackupPolicyOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + deleteBackupPolicyOptionsModel.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.CreatePlacementGroup(createPlacementGroupOptionsModel) + result, response, operationErr := vpcService.DeleteBackupPolicy(deleteBackupPolicyOptionsModel) 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.CreatePlacementGroup(createPlacementGroupOptionsModel) + result, response, operationErr = vpcService.DeleteBackupPolicy(deleteBackupPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -41783,34 +42335,20 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreatePlacementGroup(createPlacementGroupOptions *CreatePlacementGroupOptions)`, func() { + Describe(`DeleteBackupPolicy(deleteBackupPolicyOptions *DeleteBackupPolicyOptions)`, func() { version := "testString" - createPlacementGroupPath := "/placement_groups" + deleteBackupPolicyPath := "/backup_policies/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(createPlacementGroupPath)) - 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.EscapedPath()).To(Equal(deleteBackupPolicyPath)) + 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))})) // Sleep a short time to support a timeout test @@ -41818,11 +42356,11 @@ 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", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}`) + res.WriteHeader(202) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_user_tags": ["MatchUserTags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/123456::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "fee82deba12e4c0fb69c3b09d1f12345", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}`) })) }) - It(`Invoke CreatePlacementGroup successfully with retries`, func() { + It(`Invoke DeleteBackupPolicy successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -41832,27 +42370,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreatePlacementGroupOptions model - createPlacementGroupOptionsModel := new(vpcv1.CreatePlacementGroupOptions) - createPlacementGroupOptionsModel.Strategy = core.StringPtr("host_spread") - createPlacementGroupOptionsModel.Name = core.StringPtr("my-placement-group") - createPlacementGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel - createPlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteBackupPolicyOptions model + deleteBackupPolicyOptionsModel := new(vpcv1.DeleteBackupPolicyOptions) + deleteBackupPolicyOptionsModel.ID = core.StringPtr("testString") + deleteBackupPolicyOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + deleteBackupPolicyOptionsModel.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.CreatePlacementGroupWithContext(ctx, createPlacementGroupOptionsModel) + _, _, operationErr := vpcService.DeleteBackupPolicyWithContext(ctx, deleteBackupPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.CreatePlacementGroup(createPlacementGroupOptionsModel) + result, response, operationErr := vpcService.DeleteBackupPolicy(deleteBackupPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -41860,7 +42393,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreatePlacementGroupWithContext(ctx, createPlacementGroupOptionsModel) + _, _, operationErr = vpcService.DeleteBackupPolicyWithContext(ctx, deleteBackupPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -41874,34 +42407,20 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createPlacementGroupPath)) - 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.EscapedPath()).To(Equal(deleteBackupPolicyPath)) + 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))})) // 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", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}`) + res.WriteHeader(202) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_user_tags": ["MatchUserTags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/123456::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "fee82deba12e4c0fb69c3b09d1f12345", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}`) })) }) - It(`Invoke CreatePlacementGroup successfully`, func() { + It(`Invoke DeleteBackupPolicy successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -41911,30 +42430,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreatePlacementGroup(nil) + result, response, operationErr := vpcService.DeleteBackupPolicy(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreatePlacementGroupOptions model - createPlacementGroupOptionsModel := new(vpcv1.CreatePlacementGroupOptions) - createPlacementGroupOptionsModel.Strategy = core.StringPtr("host_spread") - createPlacementGroupOptionsModel.Name = core.StringPtr("my-placement-group") - createPlacementGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel - createPlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteBackupPolicyOptions model + deleteBackupPolicyOptionsModel := new(vpcv1.DeleteBackupPolicyOptions) + deleteBackupPolicyOptionsModel.ID = core.StringPtr("testString") + deleteBackupPolicyOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + deleteBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreatePlacementGroup(createPlacementGroupOptionsModel) + result, response, operationErr = vpcService.DeleteBackupPolicy(deleteBackupPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreatePlacementGroup with error: Operation validation and request error`, func() { + It(`Invoke DeleteBackupPolicy with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -41943,28 +42457,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreatePlacementGroupOptions model - createPlacementGroupOptionsModel := new(vpcv1.CreatePlacementGroupOptions) - createPlacementGroupOptionsModel.Strategy = core.StringPtr("host_spread") - createPlacementGroupOptionsModel.Name = core.StringPtr("my-placement-group") - createPlacementGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel - createPlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteBackupPolicyOptions model + deleteBackupPolicyOptionsModel := new(vpcv1.DeleteBackupPolicyOptions) + deleteBackupPolicyOptionsModel.ID = core.StringPtr("testString") + deleteBackupPolicyOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + deleteBackupPolicyOptionsModel.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.CreatePlacementGroup(createPlacementGroupOptionsModel) + result, response, operationErr := vpcService.DeleteBackupPolicy(deleteBackupPolicyOptionsModel) 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 CreatePlacementGroupOptions model with no property values - createPlacementGroupOptionsModelNew := new(vpcv1.CreatePlacementGroupOptions) + // Construct a second instance of the DeleteBackupPolicyOptions model with no property values + deleteBackupPolicyOptionsModelNew := new(vpcv1.DeleteBackupPolicyOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreatePlacementGroup(createPlacementGroupOptionsModelNew) + result, response, operationErr = vpcService.DeleteBackupPolicy(deleteBackupPolicyOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -41979,10 +42488,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(202) })) }) - It(`Invoke CreatePlacementGroup successfully`, func() { + It(`Invoke DeleteBackupPolicy successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -41991,19 +42500,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreatePlacementGroupOptions model - createPlacementGroupOptionsModel := new(vpcv1.CreatePlacementGroupOptions) - createPlacementGroupOptionsModel.Strategy = core.StringPtr("host_spread") - createPlacementGroupOptionsModel.Name = core.StringPtr("my-placement-group") - createPlacementGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel - createPlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteBackupPolicyOptions model + deleteBackupPolicyOptionsModel := new(vpcv1.DeleteBackupPolicyOptions) + deleteBackupPolicyOptionsModel.ID = core.StringPtr("testString") + deleteBackupPolicyOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + deleteBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.CreatePlacementGroup(createPlacementGroupOptionsModel) + result, response, operationErr := vpcService.DeleteBackupPolicy(deleteBackupPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -42015,89 +42519,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeletePlacementGroup(deletePlacementGroupOptions *DeletePlacementGroupOptions)`, func() { - version := "testString" - deletePlacementGroupPath := "/placement_groups/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(deletePlacementGroupPath)) - 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 DeletePlacementGroup 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.DeletePlacementGroup(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeletePlacementGroupOptions model - deletePlacementGroupOptionsModel := new(vpcv1.DeletePlacementGroupOptions) - deletePlacementGroupOptionsModel.ID = core.StringPtr("testString") - deletePlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeletePlacementGroup(deletePlacementGroupOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeletePlacementGroup 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 DeletePlacementGroupOptions model - deletePlacementGroupOptionsModel := new(vpcv1.DeletePlacementGroupOptions) - deletePlacementGroupOptionsModel.ID = core.StringPtr("testString") - deletePlacementGroupOptionsModel.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.DeletePlacementGroup(deletePlacementGroupOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeletePlacementGroupOptions model with no property values - deletePlacementGroupOptionsModelNew := new(vpcv1.DeletePlacementGroupOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeletePlacementGroup(deletePlacementGroupOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetPlacementGroup(getPlacementGroupOptions *GetPlacementGroupOptions) - Operation response error`, func() { + Describe(`GetBackupPolicy(getBackupPolicyOptions *GetBackupPolicyOptions) - Operation response error`, func() { version := "testString" - getPlacementGroupPath := "/placement_groups/testString" + getBackupPolicyPath := "/backup_policies/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(getPlacementGroupPath)) + Expect(req.URL.EscapedPath()).To(Equal(getBackupPolicyPath)) 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))})) @@ -42106,7 +42537,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetPlacementGroup with error: Operation response processing error`, func() { + It(`Invoke GetBackupPolicy with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -42115,19 +42546,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetPlacementGroupOptions model - getPlacementGroupOptionsModel := new(vpcv1.GetPlacementGroupOptions) - getPlacementGroupOptionsModel.ID = core.StringPtr("testString") - getPlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBackupPolicyOptions model + getBackupPolicyOptionsModel := new(vpcv1.GetBackupPolicyOptions) + getBackupPolicyOptionsModel.ID = core.StringPtr("testString") + getBackupPolicyOptionsModel.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.GetPlacementGroup(getPlacementGroupOptionsModel) + result, response, operationErr := vpcService.GetBackupPolicy(getBackupPolicyOptionsModel) 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.GetPlacementGroup(getPlacementGroupOptionsModel) + result, response, operationErr = vpcService.GetBackupPolicy(getBackupPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -42137,16 +42568,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetPlacementGroup(getPlacementGroupOptions *GetPlacementGroupOptions)`, func() { + Describe(`GetBackupPolicy(getBackupPolicyOptions *GetBackupPolicyOptions)`, func() { version := "testString" - getPlacementGroupPath := "/placement_groups/testString" + getBackupPolicyPath := "/backup_policies/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(getPlacementGroupPath)) + Expect(req.URL.EscapedPath()).To(Equal(getBackupPolicyPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -42157,10 +42588,10 @@ 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::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_user_tags": ["MatchUserTags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/123456::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "fee82deba12e4c0fb69c3b09d1f12345", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}`) })) }) - It(`Invoke GetPlacementGroup successfully with retries`, func() { + It(`Invoke GetBackupPolicy successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -42170,21 +42601,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetPlacementGroupOptions model - getPlacementGroupOptionsModel := new(vpcv1.GetPlacementGroupOptions) - getPlacementGroupOptionsModel.ID = core.StringPtr("testString") - getPlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBackupPolicyOptions model + getBackupPolicyOptionsModel := new(vpcv1.GetBackupPolicyOptions) + getBackupPolicyOptionsModel.ID = core.StringPtr("testString") + getBackupPolicyOptionsModel.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.GetPlacementGroupWithContext(ctx, getPlacementGroupOptionsModel) + _, _, operationErr := vpcService.GetBackupPolicyWithContext(ctx, getBackupPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetPlacementGroup(getPlacementGroupOptionsModel) + result, response, operationErr := vpcService.GetBackupPolicy(getBackupPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -42192,7 +42623,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetPlacementGroupWithContext(ctx, getPlacementGroupOptionsModel) + _, _, operationErr = vpcService.GetBackupPolicyWithContext(ctx, getBackupPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -42206,7 +42637,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getPlacementGroupPath)) + Expect(req.URL.EscapedPath()).To(Equal(getBackupPolicyPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -42214,10 +42645,10 @@ 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::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_user_tags": ["MatchUserTags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/123456::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "fee82deba12e4c0fb69c3b09d1f12345", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}`) })) }) - It(`Invoke GetPlacementGroup successfully`, func() { + It(`Invoke GetBackupPolicy successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -42227,24 +42658,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetPlacementGroup(nil) + result, response, operationErr := vpcService.GetBackupPolicy(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetPlacementGroupOptions model - getPlacementGroupOptionsModel := new(vpcv1.GetPlacementGroupOptions) - getPlacementGroupOptionsModel.ID = core.StringPtr("testString") - getPlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBackupPolicyOptions model + getBackupPolicyOptionsModel := new(vpcv1.GetBackupPolicyOptions) + getBackupPolicyOptionsModel.ID = core.StringPtr("testString") + getBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetPlacementGroup(getPlacementGroupOptionsModel) + result, response, operationErr = vpcService.GetBackupPolicy(getBackupPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetPlacementGroup with error: Operation validation and request error`, func() { + It(`Invoke GetBackupPolicy with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -42253,22 +42684,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetPlacementGroupOptions model - getPlacementGroupOptionsModel := new(vpcv1.GetPlacementGroupOptions) - getPlacementGroupOptionsModel.ID = core.StringPtr("testString") - getPlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBackupPolicyOptions model + getBackupPolicyOptionsModel := new(vpcv1.GetBackupPolicyOptions) + getBackupPolicyOptionsModel.ID = core.StringPtr("testString") + getBackupPolicyOptionsModel.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.GetPlacementGroup(getPlacementGroupOptionsModel) + result, response, operationErr := vpcService.GetBackupPolicy(getBackupPolicyOptionsModel) 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 GetPlacementGroupOptions model with no property values - getPlacementGroupOptionsModelNew := new(vpcv1.GetPlacementGroupOptions) + // Construct a second instance of the GetBackupPolicyOptions model with no property values + getBackupPolicyOptionsModelNew := new(vpcv1.GetBackupPolicyOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetPlacementGroup(getPlacementGroupOptionsModelNew) + result, response, operationErr = vpcService.GetBackupPolicy(getBackupPolicyOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -42286,7 +42717,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetPlacementGroup successfully`, func() { + It(`Invoke GetBackupPolicy successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -42295,13 +42726,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetPlacementGroupOptions model - getPlacementGroupOptionsModel := new(vpcv1.GetPlacementGroupOptions) - getPlacementGroupOptionsModel.ID = core.StringPtr("testString") - getPlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBackupPolicyOptions model + getBackupPolicyOptionsModel := new(vpcv1.GetBackupPolicyOptions) + getBackupPolicyOptionsModel.ID = core.StringPtr("testString") + getBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetPlacementGroup(getPlacementGroupOptionsModel) + result, response, operationErr := vpcService.GetBackupPolicy(getBackupPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -42313,17 +42744,19 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdatePlacementGroup(updatePlacementGroupOptions *UpdatePlacementGroupOptions) - Operation response error`, func() { + Describe(`UpdateBackupPolicy(updateBackupPolicyOptions *UpdateBackupPolicyOptions) - Operation response error`, func() { version := "testString" - updatePlacementGroupPath := "/placement_groups/testString" + updateBackupPolicyPath := "/backup_policies/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(updatePlacementGroupPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateBackupPolicyPath)) 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") @@ -42331,7 +42764,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdatePlacementGroup with error: Operation response processing error`, func() { + It(`Invoke UpdateBackupPolicy with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -42340,26 +42773,29 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the PlacementGroupPatch model - placementGroupPatchModel := new(vpcv1.PlacementGroupPatch) - placementGroupPatchModel.Name = core.StringPtr("my-placement-group") - placementGroupPatchModelAsPatch, asPatchErr := placementGroupPatchModel.AsPatch() + // Construct an instance of the BackupPolicyPatch model + backupPolicyPatchModel := new(vpcv1.BackupPolicyPatch) + backupPolicyPatchModel.IncludedContent = []string{"data_volumes"} + backupPolicyPatchModel.MatchUserTags = []string{"my-daily-backup-policy"} + backupPolicyPatchModel.Name = core.StringPtr("my-backup-policy") + backupPolicyPatchModelAsPatch, asPatchErr := backupPolicyPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdatePlacementGroupOptions model - updatePlacementGroupOptionsModel := new(vpcv1.UpdatePlacementGroupOptions) - updatePlacementGroupOptionsModel.ID = core.StringPtr("testString") - updatePlacementGroupOptionsModel.PlacementGroupPatch = placementGroupPatchModelAsPatch - updatePlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateBackupPolicyOptions model + updateBackupPolicyOptionsModel := new(vpcv1.UpdateBackupPolicyOptions) + updateBackupPolicyOptionsModel.ID = core.StringPtr("testString") + updateBackupPolicyOptionsModel.BackupPolicyPatch = backupPolicyPatchModelAsPatch + updateBackupPolicyOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateBackupPolicyOptionsModel.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.UpdatePlacementGroup(updatePlacementGroupOptionsModel) + result, response, operationErr := vpcService.UpdateBackupPolicy(updateBackupPolicyOptionsModel) 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.UpdatePlacementGroup(updatePlacementGroupOptionsModel) + result, response, operationErr = vpcService.UpdateBackupPolicy(updateBackupPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -42369,16 +42805,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdatePlacementGroup(updatePlacementGroupOptions *UpdatePlacementGroupOptions)`, func() { + Describe(`UpdateBackupPolicy(updateBackupPolicyOptions *UpdateBackupPolicyOptions)`, func() { version := "testString" - updatePlacementGroupPath := "/placement_groups/testString" + updateBackupPolicyPath := "/backup_policies/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(updatePlacementGroupPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateBackupPolicyPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -42397,6 +42833,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 @@ -42405,10 +42843,10 @@ 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::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_user_tags": ["MatchUserTags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/123456::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "fee82deba12e4c0fb69c3b09d1f12345", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}`) })) }) - It(`Invoke UpdatePlacementGroup successfully with retries`, func() { + It(`Invoke UpdateBackupPolicy successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -42418,28 +42856,31 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the PlacementGroupPatch model - placementGroupPatchModel := new(vpcv1.PlacementGroupPatch) - placementGroupPatchModel.Name = core.StringPtr("my-placement-group") - placementGroupPatchModelAsPatch, asPatchErr := placementGroupPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdatePlacementGroupOptions model - updatePlacementGroupOptionsModel := new(vpcv1.UpdatePlacementGroupOptions) - updatePlacementGroupOptionsModel.ID = core.StringPtr("testString") - updatePlacementGroupOptionsModel.PlacementGroupPatch = placementGroupPatchModelAsPatch - updatePlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the BackupPolicyPatch model + backupPolicyPatchModel := new(vpcv1.BackupPolicyPatch) + backupPolicyPatchModel.IncludedContent = []string{"data_volumes"} + backupPolicyPatchModel.MatchUserTags = []string{"my-daily-backup-policy"} + backupPolicyPatchModel.Name = core.StringPtr("my-backup-policy") + backupPolicyPatchModelAsPatch, asPatchErr := backupPolicyPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateBackupPolicyOptions model + updateBackupPolicyOptionsModel := new(vpcv1.UpdateBackupPolicyOptions) + updateBackupPolicyOptionsModel.ID = core.StringPtr("testString") + updateBackupPolicyOptionsModel.BackupPolicyPatch = backupPolicyPatchModelAsPatch + updateBackupPolicyOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateBackupPolicyOptionsModel.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.UpdatePlacementGroupWithContext(ctx, updatePlacementGroupOptionsModel) + _, _, operationErr := vpcService.UpdateBackupPolicyWithContext(ctx, updateBackupPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdatePlacementGroup(updatePlacementGroupOptionsModel) + result, response, operationErr := vpcService.UpdateBackupPolicy(updateBackupPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -42447,7 +42888,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdatePlacementGroupWithContext(ctx, updatePlacementGroupOptionsModel) + _, _, operationErr = vpcService.UpdateBackupPolicyWithContext(ctx, updateBackupPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -42461,7 +42902,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updatePlacementGroupPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateBackupPolicyPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -42480,15 +42921,17 @@ 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", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "health_reasons": [{"code": "missing_service_authorization_policies", "message": "One or more accounts are missing service authorization policies", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-backup-service-about&interface=ui"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "id": "r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "last_job_completed_at": "2019-01-01T12:00:00.000Z", "lifecycle_state": "stable", "match_user_tags": ["MatchUserTags"], "name": "my-backup-policy", "plans": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "backup_policy", "scope": {"crn": "crn:v1:bluemix:public:enterprise::a/123456::enterprise:ebc2b430240943458b9e91e1432cfcce", "id": "fee82deba12e4c0fb69c3b09d1f12345", "resource_type": "enterprise"}, "included_content": ["data_volumes"], "match_resource_type": "instance"}`) })) }) - It(`Invoke UpdatePlacementGroup successfully`, func() { + It(`Invoke UpdateBackupPolicy successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -42498,31 +42941,34 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdatePlacementGroup(nil) + result, response, operationErr := vpcService.UpdateBackupPolicy(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the PlacementGroupPatch model - placementGroupPatchModel := new(vpcv1.PlacementGroupPatch) - placementGroupPatchModel.Name = core.StringPtr("my-placement-group") - placementGroupPatchModelAsPatch, asPatchErr := placementGroupPatchModel.AsPatch() + // Construct an instance of the BackupPolicyPatch model + backupPolicyPatchModel := new(vpcv1.BackupPolicyPatch) + backupPolicyPatchModel.IncludedContent = []string{"data_volumes"} + backupPolicyPatchModel.MatchUserTags = []string{"my-daily-backup-policy"} + backupPolicyPatchModel.Name = core.StringPtr("my-backup-policy") + backupPolicyPatchModelAsPatch, asPatchErr := backupPolicyPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdatePlacementGroupOptions model - updatePlacementGroupOptionsModel := new(vpcv1.UpdatePlacementGroupOptions) - updatePlacementGroupOptionsModel.ID = core.StringPtr("testString") - updatePlacementGroupOptionsModel.PlacementGroupPatch = placementGroupPatchModelAsPatch - updatePlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateBackupPolicyOptions model + updateBackupPolicyOptionsModel := new(vpcv1.UpdateBackupPolicyOptions) + updateBackupPolicyOptionsModel.ID = core.StringPtr("testString") + updateBackupPolicyOptionsModel.BackupPolicyPatch = backupPolicyPatchModelAsPatch + updateBackupPolicyOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdatePlacementGroup(updatePlacementGroupOptionsModel) + result, response, operationErr = vpcService.UpdateBackupPolicy(updateBackupPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdatePlacementGroup with error: Operation validation and request error`, func() { + It(`Invoke UpdateBackupPolicy with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -42531,29 +42977,32 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the PlacementGroupPatch model - placementGroupPatchModel := new(vpcv1.PlacementGroupPatch) - placementGroupPatchModel.Name = core.StringPtr("my-placement-group") - placementGroupPatchModelAsPatch, asPatchErr := placementGroupPatchModel.AsPatch() + // Construct an instance of the BackupPolicyPatch model + backupPolicyPatchModel := new(vpcv1.BackupPolicyPatch) + backupPolicyPatchModel.IncludedContent = []string{"data_volumes"} + backupPolicyPatchModel.MatchUserTags = []string{"my-daily-backup-policy"} + backupPolicyPatchModel.Name = core.StringPtr("my-backup-policy") + backupPolicyPatchModelAsPatch, asPatchErr := backupPolicyPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdatePlacementGroupOptions model - updatePlacementGroupOptionsModel := new(vpcv1.UpdatePlacementGroupOptions) - updatePlacementGroupOptionsModel.ID = core.StringPtr("testString") - updatePlacementGroupOptionsModel.PlacementGroupPatch = placementGroupPatchModelAsPatch - updatePlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateBackupPolicyOptions model + updateBackupPolicyOptionsModel := new(vpcv1.UpdateBackupPolicyOptions) + updateBackupPolicyOptionsModel.ID = core.StringPtr("testString") + updateBackupPolicyOptionsModel.BackupPolicyPatch = backupPolicyPatchModelAsPatch + updateBackupPolicyOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateBackupPolicyOptionsModel.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.UpdatePlacementGroup(updatePlacementGroupOptionsModel) + result, response, operationErr := vpcService.UpdateBackupPolicy(updateBackupPolicyOptionsModel) 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 UpdatePlacementGroupOptions model with no property values - updatePlacementGroupOptionsModelNew := new(vpcv1.UpdatePlacementGroupOptions) + // Construct a second instance of the UpdateBackupPolicyOptions model with no property values + updateBackupPolicyOptionsModelNew := new(vpcv1.UpdateBackupPolicyOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdatePlacementGroup(updatePlacementGroupOptionsModelNew) + result, response, operationErr = vpcService.UpdateBackupPolicy(updateBackupPolicyOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -42571,7 +43020,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdatePlacementGroup successfully`, func() { + It(`Invoke UpdateBackupPolicy successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -42580,20 +43029,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the PlacementGroupPatch model - placementGroupPatchModel := new(vpcv1.PlacementGroupPatch) - placementGroupPatchModel.Name = core.StringPtr("my-placement-group") - placementGroupPatchModelAsPatch, asPatchErr := placementGroupPatchModel.AsPatch() + // Construct an instance of the BackupPolicyPatch model + backupPolicyPatchModel := new(vpcv1.BackupPolicyPatch) + backupPolicyPatchModel.IncludedContent = []string{"data_volumes"} + backupPolicyPatchModel.MatchUserTags = []string{"my-daily-backup-policy"} + backupPolicyPatchModel.Name = core.StringPtr("my-backup-policy") + backupPolicyPatchModelAsPatch, asPatchErr := backupPolicyPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdatePlacementGroupOptions model - updatePlacementGroupOptionsModel := new(vpcv1.UpdatePlacementGroupOptions) - updatePlacementGroupOptionsModel.ID = core.StringPtr("testString") - updatePlacementGroupOptionsModel.PlacementGroupPatch = placementGroupPatchModelAsPatch - updatePlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateBackupPolicyOptions model + updateBackupPolicyOptionsModel := new(vpcv1.UpdateBackupPolicyOptions) + updateBackupPolicyOptionsModel.ID = core.StringPtr("testString") + updateBackupPolicyOptionsModel.BackupPolicyPatch = backupPolicyPatchModelAsPatch + updateBackupPolicyOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.UpdatePlacementGroup(updatePlacementGroupOptionsModel) + result, response, operationErr := vpcService.UpdateBackupPolicy(updateBackupPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -42605,16 +43057,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListBareMetalServerProfiles(listBareMetalServerProfilesOptions *ListBareMetalServerProfilesOptions) - Operation response error`, func() { + Describe(`ListPlacementGroups(listPlacementGroupsOptions *ListPlacementGroupsOptions) - Operation response error`, func() { version := "testString" - listBareMetalServerProfilesPath := "/bare_metal_server/profiles" + listPlacementGroupsPath := "/placement_groups" 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(listBareMetalServerProfilesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listPlacementGroupsPath)) 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))})) @@ -42625,7 +43077,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListBareMetalServerProfiles with error: Operation response processing error`, func() { + It(`Invoke ListPlacementGroups with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -42634,20 +43086,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBareMetalServerProfilesOptions model - listBareMetalServerProfilesOptionsModel := new(vpcv1.ListBareMetalServerProfilesOptions) - listBareMetalServerProfilesOptionsModel.Start = core.StringPtr("testString") - listBareMetalServerProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBareMetalServerProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListPlacementGroupsOptions model + listPlacementGroupsOptionsModel := new(vpcv1.ListPlacementGroupsOptions) + listPlacementGroupsOptionsModel.Start = core.StringPtr("testString") + listPlacementGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listPlacementGroupsOptionsModel.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.ListBareMetalServerProfiles(listBareMetalServerProfilesOptionsModel) + result, response, operationErr := vpcService.ListPlacementGroups(listPlacementGroupsOptionsModel) 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.ListBareMetalServerProfiles(listBareMetalServerProfilesOptionsModel) + result, response, operationErr = vpcService.ListPlacementGroups(listPlacementGroupsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -42657,16 +43109,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListBareMetalServerProfiles(listBareMetalServerProfilesOptions *ListBareMetalServerProfilesOptions)`, func() { + Describe(`ListPlacementGroups(listPlacementGroupsOptions *ListPlacementGroupsOptions)`, func() { version := "testString" - listBareMetalServerProfilesPath := "/bare_metal_server/profiles" + listPlacementGroupsPath := "/placement_groups" 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(listBareMetalServerProfilesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listPlacementGroupsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -42679,10 +43131,10 @@ 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/bare_metal_servers/profiles?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "profiles": [{"bandwidth": {"type": "fixed", "value": 20000}, "console_types": {"type": "enum", "values": ["serial"]}, "cpu_architecture": {"default": "amd64", "type": "fixed", "value": "amd64"}, "cpu_core_count": {"type": "fixed", "value": 80}, "cpu_socket_count": {"type": "fixed", "value": 4}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "fcp", "type": "enum", "values": ["fcp"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "memory": {"type": "fixed", "value": 16}, "name": "bx2-metal-192x768", "network_interface_count": {"max": 128, "min": 1, "type": "range"}, "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"type": "enum", "values": ["disabled"]}}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "placement_groups": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}], "total_count": 132}`) })) }) - It(`Invoke ListBareMetalServerProfiles successfully with retries`, func() { + It(`Invoke ListPlacementGroups successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -42692,22 +43144,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListBareMetalServerProfilesOptions model - listBareMetalServerProfilesOptionsModel := new(vpcv1.ListBareMetalServerProfilesOptions) - listBareMetalServerProfilesOptionsModel.Start = core.StringPtr("testString") - listBareMetalServerProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBareMetalServerProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListPlacementGroupsOptions model + listPlacementGroupsOptionsModel := new(vpcv1.ListPlacementGroupsOptions) + listPlacementGroupsOptionsModel.Start = core.StringPtr("testString") + listPlacementGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listPlacementGroupsOptionsModel.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.ListBareMetalServerProfilesWithContext(ctx, listBareMetalServerProfilesOptionsModel) + _, _, operationErr := vpcService.ListPlacementGroupsWithContext(ctx, listPlacementGroupsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListBareMetalServerProfiles(listBareMetalServerProfilesOptionsModel) + result, response, operationErr := vpcService.ListPlacementGroups(listPlacementGroupsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -42715,7 +43167,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListBareMetalServerProfilesWithContext(ctx, listBareMetalServerProfilesOptionsModel) + _, _, operationErr = vpcService.ListPlacementGroupsWithContext(ctx, listPlacementGroupsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -42729,7 +43181,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerProfilesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listPlacementGroupsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -42739,10 +43191,10 @@ 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/bare_metal_servers/profiles?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "profiles": [{"bandwidth": {"type": "fixed", "value": 20000}, "console_types": {"type": "enum", "values": ["serial"]}, "cpu_architecture": {"default": "amd64", "type": "fixed", "value": "amd64"}, "cpu_core_count": {"type": "fixed", "value": 80}, "cpu_socket_count": {"type": "fixed", "value": 4}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "fcp", "type": "enum", "values": ["fcp"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "memory": {"type": "fixed", "value": 16}, "name": "bx2-metal-192x768", "network_interface_count": {"max": 128, "min": 1, "type": "range"}, "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"type": "enum", "values": ["disabled"]}}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "placement_groups": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}], "total_count": 132}`) })) }) - It(`Invoke ListBareMetalServerProfiles successfully`, func() { + It(`Invoke ListPlacementGroups successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -42752,25 +43204,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListBareMetalServerProfiles(nil) + result, response, operationErr := vpcService.ListPlacementGroups(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListBareMetalServerProfilesOptions model - listBareMetalServerProfilesOptionsModel := new(vpcv1.ListBareMetalServerProfilesOptions) - listBareMetalServerProfilesOptionsModel.Start = core.StringPtr("testString") - listBareMetalServerProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBareMetalServerProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListPlacementGroupsOptions model + listPlacementGroupsOptionsModel := new(vpcv1.ListPlacementGroupsOptions) + listPlacementGroupsOptionsModel.Start = core.StringPtr("testString") + listPlacementGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listPlacementGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListBareMetalServerProfiles(listBareMetalServerProfilesOptionsModel) + result, response, operationErr = vpcService.ListPlacementGroups(listPlacementGroupsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListBareMetalServerProfiles with error: Operation request error`, func() { + It(`Invoke ListPlacementGroups with error: Operation request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -42779,15 +43231,15 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBareMetalServerProfilesOptions model - listBareMetalServerProfilesOptionsModel := new(vpcv1.ListBareMetalServerProfilesOptions) - listBareMetalServerProfilesOptionsModel.Start = core.StringPtr("testString") - listBareMetalServerProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBareMetalServerProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListPlacementGroupsOptions model + listPlacementGroupsOptionsModel := new(vpcv1.ListPlacementGroupsOptions) + listPlacementGroupsOptionsModel.Start = core.StringPtr("testString") + listPlacementGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listPlacementGroupsOptionsModel.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.ListBareMetalServerProfiles(listBareMetalServerProfilesOptionsModel) + result, response, operationErr := vpcService.ListPlacementGroups(listPlacementGroupsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) @@ -42806,7 +43258,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListBareMetalServerProfiles successfully`, func() { + It(`Invoke ListPlacementGroups successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -42815,14 +43267,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBareMetalServerProfilesOptions model - listBareMetalServerProfilesOptionsModel := new(vpcv1.ListBareMetalServerProfilesOptions) - listBareMetalServerProfilesOptionsModel.Start = core.StringPtr("testString") - listBareMetalServerProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBareMetalServerProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListPlacementGroupsOptions model + listPlacementGroupsOptionsModel := new(vpcv1.ListPlacementGroupsOptions) + listPlacementGroupsOptionsModel.Start = core.StringPtr("testString") + listPlacementGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listPlacementGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListBareMetalServerProfiles(listBareMetalServerProfilesOptionsModel) + result, response, operationErr := vpcService.ListPlacementGroups(listPlacementGroupsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -42835,8 +43287,8 @@ var _ = Describe(`VpcV1`, func() { }) Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.BareMetalServerProfileCollection) - nextObject := new(vpcv1.BareMetalServerProfileCollectionNext) + responseObject := new(vpcv1.PlacementGroupCollection) + nextObject := new(vpcv1.PlacementGroupCollectionNext) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -42845,15 +43297,15 @@ var _ = Describe(`VpcV1`, func() { Expect(value).To(Equal(core.StringPtr("abc-123"))) }) It(`Invoke GetNextStart without a "Next" property in the response`, func() { - responseObject := new(vpcv1.BareMetalServerProfileCollection) + responseObject := new(vpcv1.PlacementGroupCollection) 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.BareMetalServerProfileCollection) - nextObject := new(vpcv1.BareMetalServerProfileCollectionNext) + responseObject := new(vpcv1.PlacementGroupCollection) + nextObject := new(vpcv1.PlacementGroupCollectionNext) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -42869,7 +43321,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerProfilesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listPlacementGroupsPath)) Expect(req.Method).To(Equal("GET")) // Set mock response @@ -42877,15 +43329,15 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) requestNumber++ if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"profiles":[{"bandwidth":{"type":"fixed","value":20000},"console_types":{"type":"enum","values":["serial"]},"cpu_architecture":{"default":"amd64","type":"fixed","value":"amd64"},"cpu_core_count":{"type":"fixed","value":80},"cpu_socket_count":{"type":"fixed","value":4},"disks":[{"quantity":{"type":"fixed","value":4},"size":{"type":"fixed","value":100},"supported_interface_types":{"default":"fcp","type":"enum","values":["fcp"]}}],"family":"balanced","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768","memory":{"type":"fixed","value":16},"name":"bx2-metal-192x768","network_interface_count":{"max":128,"min":1,"type":"range"},"os_architecture":{"default":"amd64","type":"enum","values":["amd64"]},"resource_type":"bare_metal_server_profile","supported_trusted_platform_module_modes":{"type":"enum","values":["disabled"]}}]}`) + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"placement_groups":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871","href":"https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871","id":"r018-418fe842-a3e9-47b9-a938-1aa5bd632871","lifecycle_state":"stable","name":"my-placement-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"placement_group","strategy":"host_spread"}]}`) } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"profiles":[{"bandwidth":{"type":"fixed","value":20000},"console_types":{"type":"enum","values":["serial"]},"cpu_architecture":{"default":"amd64","type":"fixed","value":"amd64"},"cpu_core_count":{"type":"fixed","value":80},"cpu_socket_count":{"type":"fixed","value":4},"disks":[{"quantity":{"type":"fixed","value":4},"size":{"type":"fixed","value":100},"supported_interface_types":{"default":"fcp","type":"enum","values":["fcp"]}}],"family":"balanced","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768","memory":{"type":"fixed","value":16},"name":"bx2-metal-192x768","network_interface_count":{"max":128,"min":1,"type":"range"},"os_architecture":{"default":"amd64","type":"enum","values":["amd64"]},"resource_type":"bare_metal_server_profile","supported_trusted_platform_module_modes":{"type":"enum","values":["disabled"]}}]}`) + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"placement_groups":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871","href":"https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871","id":"r018-418fe842-a3e9-47b9-a938-1aa5bd632871","lifecycle_state":"stable","name":"my-placement-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"placement_group","strategy":"host_spread"}]}`) } else { res.WriteHeader(400) } })) }) - It(`Use BareMetalServerProfilesPager.GetNext successfully`, func() { + It(`Use PlacementGroupsPager.GetNext successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -42894,15 +43346,15 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listBareMetalServerProfilesOptionsModel := &vpcv1.ListBareMetalServerProfilesOptions{ + listPlacementGroupsOptionsModel := &vpcv1.ListPlacementGroupsOptions{ Limit: core.Int64Ptr(int64(10)), } - pager, err := vpcService.NewBareMetalServerProfilesPager(listBareMetalServerProfilesOptionsModel) + pager, err := vpcService.NewPlacementGroupsPager(listPlacementGroupsOptionsModel) Expect(err).To(BeNil()) Expect(pager).ToNot(BeNil()) - var allResults []vpcv1.BareMetalServerProfile + var allResults []vpcv1.PlacementGroup for pager.HasNext() { nextPage, err := pager.GetNext() Expect(err).To(BeNil()) @@ -42911,7 +43363,7 @@ var _ = Describe(`VpcV1`, func() { } Expect(len(allResults)).To(Equal(2)) }) - It(`Use BareMetalServerProfilesPager.GetAll successfully`, func() { + It(`Use PlacementGroupsPager.GetAll successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -42920,11 +43372,11 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listBareMetalServerProfilesOptionsModel := &vpcv1.ListBareMetalServerProfilesOptions{ + listPlacementGroupsOptionsModel := &vpcv1.ListPlacementGroupsOptions{ Limit: core.Int64Ptr(int64(10)), } - pager, err := vpcService.NewBareMetalServerProfilesPager(listBareMetalServerProfilesOptionsModel) + pager, err := vpcService.NewPlacementGroupsPager(listPlacementGroupsOptionsModel) Expect(err).To(BeNil()) Expect(pager).ToNot(BeNil()) @@ -42935,25 +43387,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetBareMetalServerProfile(getBareMetalServerProfileOptions *GetBareMetalServerProfileOptions) - Operation response error`, func() { + Describe(`CreatePlacementGroup(createPlacementGroupOptions *CreatePlacementGroupOptions) - Operation response error`, func() { version := "testString" - getBareMetalServerProfilePath := "/bare_metal_server/profiles/testString" + createPlacementGroupPath := "/placement_groups" 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(getBareMetalServerProfilePath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createPlacementGroupPath)) + 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(200) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetBareMetalServerProfile with error: Operation response processing error`, func() { + It(`Invoke CreatePlacementGroup with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -42962,19 +43414,25 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBareMetalServerProfileOptions model - getBareMetalServerProfileOptionsModel := new(vpcv1.GetBareMetalServerProfileOptions) - getBareMetalServerProfileOptionsModel.Name = core.StringPtr("testString") - getBareMetalServerProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreatePlacementGroupOptions model + createPlacementGroupOptionsModel := new(vpcv1.CreatePlacementGroupOptions) + createPlacementGroupOptionsModel.Strategy = core.StringPtr("host_spread") + createPlacementGroupOptionsModel.Name = core.StringPtr("my-placement-group") + createPlacementGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel + createPlacementGroupOptionsModel.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.GetBareMetalServerProfile(getBareMetalServerProfileOptionsModel) + result, response, operationErr := vpcService.CreatePlacementGroup(createPlacementGroupOptionsModel) 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.GetBareMetalServerProfile(getBareMetalServerProfileOptionsModel) + result, response, operationErr = vpcService.CreatePlacementGroup(createPlacementGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -42984,17 +43442,33 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetBareMetalServerProfile(getBareMetalServerProfileOptions *GetBareMetalServerProfileOptions)`, func() { + Describe(`CreatePlacementGroup(createPlacementGroupOptions *CreatePlacementGroupOptions)`, func() { version := "testString" - getBareMetalServerProfilePath := "/bare_metal_server/profiles/testString" + createPlacementGroupPath := "/placement_groups" 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(getBareMetalServerProfilePath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createPlacementGroupPath)) + 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))})) @@ -43003,11 +43477,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"bandwidth": {"type": "fixed", "value": 20000}, "console_types": {"type": "enum", "values": ["serial"]}, "cpu_architecture": {"default": "amd64", "type": "fixed", "value": "amd64"}, "cpu_core_count": {"type": "fixed", "value": 80}, "cpu_socket_count": {"type": "fixed", "value": 4}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "fcp", "type": "enum", "values": ["fcp"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "memory": {"type": "fixed", "value": 16}, "name": "bx2-metal-192x768", "network_interface_count": {"max": 128, "min": 1, "type": "range"}, "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"type": "enum", "values": ["disabled"]}}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}`) })) }) - It(`Invoke GetBareMetalServerProfile successfully with retries`, func() { + It(`Invoke CreatePlacementGroup successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -43017,21 +43491,27 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetBareMetalServerProfileOptions model - getBareMetalServerProfileOptionsModel := new(vpcv1.GetBareMetalServerProfileOptions) - getBareMetalServerProfileOptionsModel.Name = core.StringPtr("testString") - getBareMetalServerProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreatePlacementGroupOptions model + createPlacementGroupOptionsModel := new(vpcv1.CreatePlacementGroupOptions) + createPlacementGroupOptionsModel.Strategy = core.StringPtr("host_spread") + createPlacementGroupOptionsModel.Name = core.StringPtr("my-placement-group") + createPlacementGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel + createPlacementGroupOptionsModel.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.GetBareMetalServerProfileWithContext(ctx, getBareMetalServerProfileOptionsModel) + _, _, operationErr := vpcService.CreatePlacementGroupWithContext(ctx, createPlacementGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetBareMetalServerProfile(getBareMetalServerProfileOptionsModel) + result, response, operationErr := vpcService.CreatePlacementGroup(createPlacementGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -43039,7 +43519,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetBareMetalServerProfileWithContext(ctx, getBareMetalServerProfileOptionsModel) + _, _, operationErr = vpcService.CreatePlacementGroupWithContext(ctx, createPlacementGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -43053,18 +43533,34 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerProfilePath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createPlacementGroupPath)) + 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(200) - fmt.Fprintf(res, "%s", `{"bandwidth": {"type": "fixed", "value": 20000}, "console_types": {"type": "enum", "values": ["serial"]}, "cpu_architecture": {"default": "amd64", "type": "fixed", "value": "amd64"}, "cpu_core_count": {"type": "fixed", "value": 80}, "cpu_socket_count": {"type": "fixed", "value": 4}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "fcp", "type": "enum", "values": ["fcp"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "memory": {"type": "fixed", "value": 16}, "name": "bx2-metal-192x768", "network_interface_count": {"max": 128, "min": 1, "type": "range"}, "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"type": "enum", "values": ["disabled"]}}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}`) })) }) - It(`Invoke GetBareMetalServerProfile successfully`, func() { + It(`Invoke CreatePlacementGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -43074,24 +43570,30 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetBareMetalServerProfile(nil) + result, response, operationErr := vpcService.CreatePlacementGroup(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetBareMetalServerProfileOptions model - getBareMetalServerProfileOptionsModel := new(vpcv1.GetBareMetalServerProfileOptions) - getBareMetalServerProfileOptionsModel.Name = core.StringPtr("testString") - getBareMetalServerProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreatePlacementGroupOptions model + createPlacementGroupOptionsModel := new(vpcv1.CreatePlacementGroupOptions) + createPlacementGroupOptionsModel.Strategy = core.StringPtr("host_spread") + createPlacementGroupOptionsModel.Name = core.StringPtr("my-placement-group") + createPlacementGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel + createPlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetBareMetalServerProfile(getBareMetalServerProfileOptionsModel) + result, response, operationErr = vpcService.CreatePlacementGroup(createPlacementGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetBareMetalServerProfile with error: Operation validation and request error`, func() { + It(`Invoke CreatePlacementGroup with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -43100,22 +43602,28 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBareMetalServerProfileOptions model - getBareMetalServerProfileOptionsModel := new(vpcv1.GetBareMetalServerProfileOptions) - getBareMetalServerProfileOptionsModel.Name = core.StringPtr("testString") - getBareMetalServerProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreatePlacementGroupOptions model + createPlacementGroupOptionsModel := new(vpcv1.CreatePlacementGroupOptions) + createPlacementGroupOptionsModel.Strategy = core.StringPtr("host_spread") + createPlacementGroupOptionsModel.Name = core.StringPtr("my-placement-group") + createPlacementGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel + createPlacementGroupOptionsModel.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.GetBareMetalServerProfile(getBareMetalServerProfileOptionsModel) + result, response, operationErr := vpcService.CreatePlacementGroup(createPlacementGroupOptionsModel) 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 GetBareMetalServerProfileOptions model with no property values - getBareMetalServerProfileOptionsModelNew := new(vpcv1.GetBareMetalServerProfileOptions) + // Construct a second instance of the CreatePlacementGroupOptions model with no property values + createPlacementGroupOptionsModelNew := new(vpcv1.CreatePlacementGroupOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetBareMetalServerProfile(getBareMetalServerProfileOptionsModelNew) + result, response, operationErr = vpcService.CreatePlacementGroup(createPlacementGroupOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -43130,10 +43638,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke GetBareMetalServerProfile successfully`, func() { + It(`Invoke CreatePlacementGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -43142,13 +43650,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBareMetalServerProfileOptions model - getBareMetalServerProfileOptionsModel := new(vpcv1.GetBareMetalServerProfileOptions) - getBareMetalServerProfileOptionsModel.Name = core.StringPtr("testString") - getBareMetalServerProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreatePlacementGroupOptions model + createPlacementGroupOptionsModel := new(vpcv1.CreatePlacementGroupOptions) + createPlacementGroupOptionsModel.Strategy = core.StringPtr("host_spread") + createPlacementGroupOptionsModel.Name = core.StringPtr("my-placement-group") + createPlacementGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel + createPlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetBareMetalServerProfile(getBareMetalServerProfileOptionsModel) + result, response, operationErr := vpcService.CreatePlacementGroup(createPlacementGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -43160,32 +43674,24 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListBareMetalServers(listBareMetalServersOptions *ListBareMetalServersOptions) - Operation response error`, func() { + Describe(`DeletePlacementGroup(deletePlacementGroupOptions *DeletePlacementGroupOptions)`, func() { version := "testString" - listBareMetalServersPath := "/bare_metal_servers" - Context(`Using mock server endpoint with invalid JSON response`, func() { + deletePlacementGroupPath := "/placement_groups/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(listBareMetalServersPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deletePlacementGroupPath)) + 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))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["vpc.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b"})) - Expect(req.URL.Query()["vpc.name"]).To(Equal([]string{"my-vpc"})) - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprint(res, `} this is not valid json {`) + res.WriteHeader(202) })) }) - It(`Invoke ListBareMetalServers with error: Operation response processing error`, func() { + It(`Invoke DeletePlacementGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -43194,65 +43700,72 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBareMetalServersOptions model - listBareMetalServersOptionsModel := new(vpcv1.ListBareMetalServersOptions) - listBareMetalServersOptionsModel.Start = core.StringPtr("testString") - listBareMetalServersOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBareMetalServersOptionsModel.ResourceGroupID = core.StringPtr("testString") - listBareMetalServersOptionsModel.Name = core.StringPtr("testString") - listBareMetalServersOptionsModel.VPCID = core.StringPtr("testString") - listBareMetalServersOptionsModel.VPCCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b") - listBareMetalServersOptionsModel.VPCName = core.StringPtr("my-vpc") - listBareMetalServersOptionsModel.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.ListBareMetalServers(listBareMetalServersOptionsModel) - Expect(operationErr).ToNot(BeNil()) + // Invoke operation with nil options model (negative test) + response, operationErr := vpcService.DeletePlacementGroup(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeletePlacementGroupOptions model + deletePlacementGroupOptionsModel := new(vpcv1.DeletePlacementGroupOptions) + deletePlacementGroupOptionsModel.ID = core.StringPtr("testString") + deletePlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeletePlacementGroup(deletePlacementGroupOptionsModel) + Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) + }) + It(`Invoke DeletePlacementGroup 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()) - // Enable retries and test again - vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ListBareMetalServers(listBareMetalServersOptionsModel) + // Construct an instance of the DeletePlacementGroupOptions model + deletePlacementGroupOptionsModel := new(vpcv1.DeletePlacementGroupOptions) + deletePlacementGroupOptionsModel.ID = core.StringPtr("testString") + deletePlacementGroupOptionsModel.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.DeletePlacementGroup(deletePlacementGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeletePlacementGroupOptions model with no property values + deletePlacementGroupOptionsModelNew := new(vpcv1.DeletePlacementGroupOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeletePlacementGroup(deletePlacementGroupOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`ListBareMetalServers(listBareMetalServersOptions *ListBareMetalServersOptions)`, func() { + Describe(`GetPlacementGroup(getPlacementGroupOptions *GetPlacementGroupOptions) - Operation response error`, func() { version := "testString" - listBareMetalServersPath := "/bare_metal_servers" - Context(`Using mock server endpoint with timeout`, func() { + getPlacementGroupPath := "/placement_groups/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(listBareMetalServersPath)) + Expect(req.URL.EscapedPath()).To(Equal(getPlacementGroupPath)) 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(10))})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["vpc.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b"})) - Expect(req.URL.Query()["vpc.name"]).To(Equal([]string{"my-vpc"})) - // 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", `{"bare_metal_servers": [{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "name": "my-bare-metal-server", "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}], "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "deleting", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "disabled", "supported_modes": ["disabled"]}, "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"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListBareMetalServers successfully with retries`, func() { + It(`Invoke GetPlacementGroup with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -43260,29 +43773,77 @@ var _ = Describe(`VpcV1`, func() { }) Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - vpcService.EnableRetries(0, 0) - // Construct an instance of the ListBareMetalServersOptions model - listBareMetalServersOptionsModel := new(vpcv1.ListBareMetalServersOptions) - listBareMetalServersOptionsModel.Start = core.StringPtr("testString") - listBareMetalServersOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBareMetalServersOptionsModel.ResourceGroupID = core.StringPtr("testString") - listBareMetalServersOptionsModel.Name = core.StringPtr("testString") - listBareMetalServersOptionsModel.VPCID = core.StringPtr("testString") - listBareMetalServersOptionsModel.VPCCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b") - listBareMetalServersOptionsModel.VPCName = core.StringPtr("my-vpc") - listBareMetalServersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetPlacementGroupOptions model + getPlacementGroupOptionsModel := new(vpcv1.GetPlacementGroupOptions) + getPlacementGroupOptionsModel.ID = core.StringPtr("testString") + getPlacementGroupOptionsModel.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.GetPlacementGroup(getPlacementGroupOptionsModel) + 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.GetPlacementGroup(getPlacementGroupOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetPlacementGroup(getPlacementGroupOptions *GetPlacementGroupOptions)`, func() { + version := "testString" + getPlacementGroupPath := "/placement_groups/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(getPlacementGroupPath)) + 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", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}`) + })) + }) + It(`Invoke GetPlacementGroup 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 GetPlacementGroupOptions model + getPlacementGroupOptionsModel := new(vpcv1.GetPlacementGroupOptions) + getPlacementGroupOptionsModel.ID = core.StringPtr("testString") + getPlacementGroupOptionsModel.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.ListBareMetalServersWithContext(ctx, listBareMetalServersOptionsModel) + _, _, operationErr := vpcService.GetPlacementGroupWithContext(ctx, getPlacementGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListBareMetalServers(listBareMetalServersOptionsModel) + result, response, operationErr := vpcService.GetPlacementGroup(getPlacementGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -43290,7 +43851,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListBareMetalServersWithContext(ctx, listBareMetalServersOptionsModel) + _, _, operationErr = vpcService.GetPlacementGroupWithContext(ctx, getPlacementGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -43304,25 +43865,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServersPath)) + Expect(req.URL.EscapedPath()).To(Equal(getPlacementGroupPath)) 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(10))})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["vpc.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b"})) - Expect(req.URL.Query()["vpc.name"]).To(Equal([]string{"my-vpc"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"bare_metal_servers": [{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "name": "my-bare-metal-server", "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}], "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "deleting", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "disabled", "supported_modes": ["disabled"]}, "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"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}`) })) }) - It(`Invoke ListBareMetalServers successfully`, func() { + It(`Invoke GetPlacementGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -43332,30 +43886,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListBareMetalServers(nil) + result, response, operationErr := vpcService.GetPlacementGroup(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListBareMetalServersOptions model - listBareMetalServersOptionsModel := new(vpcv1.ListBareMetalServersOptions) - listBareMetalServersOptionsModel.Start = core.StringPtr("testString") - listBareMetalServersOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBareMetalServersOptionsModel.ResourceGroupID = core.StringPtr("testString") - listBareMetalServersOptionsModel.Name = core.StringPtr("testString") - listBareMetalServersOptionsModel.VPCID = core.StringPtr("testString") - listBareMetalServersOptionsModel.VPCCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b") - listBareMetalServersOptionsModel.VPCName = core.StringPtr("my-vpc") - listBareMetalServersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetPlacementGroupOptions model + getPlacementGroupOptionsModel := new(vpcv1.GetPlacementGroupOptions) + getPlacementGroupOptionsModel.ID = core.StringPtr("testString") + getPlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListBareMetalServers(listBareMetalServersOptionsModel) + result, response, operationErr = vpcService.GetPlacementGroup(getPlacementGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListBareMetalServers with error: Operation request error`, func() { + It(`Invoke GetPlacementGroup with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -43364,24 +43912,25 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBareMetalServersOptions model - listBareMetalServersOptionsModel := new(vpcv1.ListBareMetalServersOptions) - listBareMetalServersOptionsModel.Start = core.StringPtr("testString") - listBareMetalServersOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBareMetalServersOptionsModel.ResourceGroupID = core.StringPtr("testString") - listBareMetalServersOptionsModel.Name = core.StringPtr("testString") - listBareMetalServersOptionsModel.VPCID = core.StringPtr("testString") - listBareMetalServersOptionsModel.VPCCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b") - listBareMetalServersOptionsModel.VPCName = core.StringPtr("my-vpc") - listBareMetalServersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetPlacementGroupOptions model + getPlacementGroupOptionsModel := new(vpcv1.GetPlacementGroupOptions) + getPlacementGroupOptionsModel.ID = core.StringPtr("testString") + getPlacementGroupOptionsModel.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.ListBareMetalServers(listBareMetalServersOptionsModel) + result, response, operationErr := vpcService.GetPlacementGroup(getPlacementGroupOptionsModel) 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 GetPlacementGroupOptions model with no property values + getPlacementGroupOptionsModelNew := new(vpcv1.GetPlacementGroupOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetPlacementGroup(getPlacementGroupOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -43396,7 +43945,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListBareMetalServers successfully`, func() { + It(`Invoke GetPlacementGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -43405,19 +43954,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBareMetalServersOptions model - listBareMetalServersOptionsModel := new(vpcv1.ListBareMetalServersOptions) - listBareMetalServersOptionsModel.Start = core.StringPtr("testString") - listBareMetalServersOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBareMetalServersOptionsModel.ResourceGroupID = core.StringPtr("testString") - listBareMetalServersOptionsModel.Name = core.StringPtr("testString") - listBareMetalServersOptionsModel.VPCID = core.StringPtr("testString") - listBareMetalServersOptionsModel.VPCCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b") - listBareMetalServersOptionsModel.VPCName = core.StringPtr("my-vpc") - listBareMetalServersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetPlacementGroupOptions model + getPlacementGroupOptionsModel := new(vpcv1.GetPlacementGroupOptions) + getPlacementGroupOptionsModel.ID = core.StringPtr("testString") + getPlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListBareMetalServers(listBareMetalServersOptionsModel) + result, response, operationErr := vpcService.GetPlacementGroup(getPlacementGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -43428,137 +43971,26 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) - Context(`Test pagination helper method on response`, func() { - It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.BareMetalServerCollection) - nextObject := new(vpcv1.BareMetalServerCollectionNext) - 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.BareMetalServerCollection) - - 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.BareMetalServerCollection) - nextObject := new(vpcv1.BareMetalServerCollectionNext) - nextObject.Href = core.StringPtr("ibm.com") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - }) - Context(`Using mock server endpoint - paginated response`, func() { - BeforeEach(func() { - var requestNumber int = 0 - 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(listBareMetalServersPath)) - Expect(req.Method).To(Equal("GET")) - - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - requestNumber++ - if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"bare_metal_servers":[{"bandwidth":20000,"boot_target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-bare-metal-server-disk","resource_type":"bare_metal_server_disk"},"cpu":{"architecture":"amd64","core_count":80,"socket_count":4,"threads_per_core":2},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a","disks":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","interface_type":"fcp","name":"my-bare-metal-server-disk","resource_type":"bare_metal_server_disk","size":100}],"enable_secure_boot":false,"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","memory":1536,"name":"my-bare-metal-server","network_interfaces":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-bare-metal-server-network-interface","primary_ip":{"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"},"resource_type":"network_interface","subnet":{"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"}}],"primary_network_interface":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-bare-metal-server-network-interface","primary_ip":{"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"},"resource_type":"network_interface","subnet":{"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"}},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768","name":"bx2-metal-192x768","resource_type":"bare_metal_server_profile"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"bare_metal_server","status":"deleting","status_reasons":[{"code":"cannot_start_capacity","message":"The bare metal server cannot start as there is no more capacity in this\\nzone for a bare metal server with the requested profile.","more_info":"https://console.bluemix.net/docs/iaas/bare_metal_server.html"}],"trusted_platform_module":{"enabled":true,"mode":"disabled","supported_modes":["disabled"]},"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"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}]}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"bare_metal_servers":[{"bandwidth":20000,"boot_target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-bare-metal-server-disk","resource_type":"bare_metal_server_disk"},"cpu":{"architecture":"amd64","core_count":80,"socket_count":4,"threads_per_core":2},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a","disks":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","interface_type":"fcp","name":"my-bare-metal-server-disk","resource_type":"bare_metal_server_disk","size":100}],"enable_secure_boot":false,"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","memory":1536,"name":"my-bare-metal-server","network_interfaces":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-bare-metal-server-network-interface","primary_ip":{"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"},"resource_type":"network_interface","subnet":{"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"}}],"primary_network_interface":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-bare-metal-server-network-interface","primary_ip":{"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"},"resource_type":"network_interface","subnet":{"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"}},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768","name":"bx2-metal-192x768","resource_type":"bare_metal_server_profile"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"bare_metal_server","status":"deleting","status_reasons":[{"code":"cannot_start_capacity","message":"The bare metal server cannot start as there is no more capacity in this\\nzone for a bare metal server with the requested profile.","more_info":"https://console.bluemix.net/docs/iaas/bare_metal_server.html"}],"trusted_platform_module":{"enabled":true,"mode":"disabled","supported_modes":["disabled"]},"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"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}]}`) - } else { - res.WriteHeader(400) - } - })) - }) - It(`Use BareMetalServersPager.GetNext 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()) - - listBareMetalServersOptionsModel := &vpcv1.ListBareMetalServersOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - Name: core.StringPtr("testString"), - VPCID: core.StringPtr("testString"), - VPCCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b"), - VPCName: core.StringPtr("my-vpc"), - } - - pager, err := vpcService.NewBareMetalServersPager(listBareMetalServersOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.BareMetalServer - for pager.HasNext() { - nextPage, err := pager.GetNext() - Expect(err).To(BeNil()) - Expect(nextPage).ToNot(BeNil()) - allResults = append(allResults, nextPage...) - } - Expect(len(allResults)).To(Equal(2)) - }) - It(`Use BareMetalServersPager.GetAll 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()) - - listBareMetalServersOptionsModel := &vpcv1.ListBareMetalServersOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - Name: core.StringPtr("testString"), - VPCID: core.StringPtr("testString"), - VPCCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b"), - VPCName: core.StringPtr("my-vpc"), - } - - pager, err := vpcService.NewBareMetalServersPager(listBareMetalServersOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - allResults, err := pager.GetAll() - Expect(err).To(BeNil()) - Expect(allResults).ToNot(BeNil()) - Expect(len(allResults)).To(Equal(2)) - }) - }) }) - Describe(`CreateBareMetalServer(createBareMetalServerOptions *CreateBareMetalServerOptions) - Operation response error`, func() { + Describe(`UpdatePlacementGroup(updatePlacementGroupOptions *UpdatePlacementGroupOptions) - Operation response error`, func() { version := "testString" - createBareMetalServerPath := "/bare_metal_servers" + updatePlacementGroupPath := "/placement_groups/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(createBareMetalServerPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(updatePlacementGroupPath)) + 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(201) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateBareMetalServer with error: Operation response processing error`, func() { + It(`Invoke UpdatePlacementGroup with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -43567,97 +43999,26 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ImageIdentityByID model - imageIdentityModel := new(vpcv1.ImageIdentityByID) - imageIdentityModel.ID = core.StringPtr("72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") - - // Construct an instance of the KeyIdentityByID model - keyIdentityModel := new(vpcv1.KeyIdentityByID) - keyIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - - // Construct an instance of the BareMetalServerInitializationPrototype model - bareMetalServerInitializationPrototypeModel := new(vpcv1.BareMetalServerInitializationPrototype) - bareMetalServerInitializationPrototypeModel.Image = imageIdentityModel - bareMetalServerInitializationPrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} - bareMetalServerInitializationPrototypeModel.UserData = core.StringPtr("testString") - - // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model - networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) - networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // 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 SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the BareMetalServerPrimaryNetworkInterfacePrototype model - bareMetalServerPrimaryNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerPrimaryNetworkInterfacePrototype) - bareMetalServerPrimaryNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerPrimaryNetworkInterfacePrototypeModel.AllowedVlans = []int64{int64(4)} - bareMetalServerPrimaryNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerPrimaryNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("pci") - bareMetalServerPrimaryNetworkInterfacePrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-interface") - bareMetalServerPrimaryNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - bareMetalServerPrimaryNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerPrimaryNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - - // Construct an instance of the BareMetalServerProfileIdentityByName model - bareMetalServerProfileIdentityModel := new(vpcv1.BareMetalServerProfileIdentityByName) - bareMetalServerProfileIdentityModel.Name = core.StringPtr("bx2-metal-192x768") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype model - bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) - bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerNetworkInterfacePrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-interface") - bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the BareMetalServerTrustedPlatformModulePrototype model - bareMetalServerTrustedPlatformModulePrototypeModel := new(vpcv1.BareMetalServerTrustedPlatformModulePrototype) - bareMetalServerTrustedPlatformModulePrototypeModel.Mode = core.StringPtr("disabled") - - // Construct an instance of the VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b") + // Construct an instance of the PlacementGroupPatch model + placementGroupPatchModel := new(vpcv1.PlacementGroupPatch) + placementGroupPatchModel.Name = core.StringPtr("my-placement-group") + placementGroupPatchModelAsPatch, asPatchErr := placementGroupPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) - // Construct an instance of the CreateBareMetalServerOptions model - createBareMetalServerOptionsModel := new(vpcv1.CreateBareMetalServerOptions) - createBareMetalServerOptionsModel.Initialization = bareMetalServerInitializationPrototypeModel - createBareMetalServerOptionsModel.PrimaryNetworkInterface = bareMetalServerPrimaryNetworkInterfacePrototypeModel - createBareMetalServerOptionsModel.Profile = bareMetalServerProfileIdentityModel - createBareMetalServerOptionsModel.Zone = zoneIdentityModel - createBareMetalServerOptionsModel.EnableSecureBoot = core.BoolPtr(false) - createBareMetalServerOptionsModel.Name = core.StringPtr("my-bare-metal-server") - createBareMetalServerOptionsModel.NetworkInterfaces = []vpcv1.BareMetalServerNetworkInterfacePrototypeIntf{bareMetalServerNetworkInterfacePrototypeModel} - createBareMetalServerOptionsModel.ResourceGroup = resourceGroupIdentityModel - createBareMetalServerOptionsModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePrototypeModel - createBareMetalServerOptionsModel.VPC = vpcIdentityModel - createBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdatePlacementGroupOptions model + updatePlacementGroupOptionsModel := new(vpcv1.UpdatePlacementGroupOptions) + updatePlacementGroupOptionsModel.ID = core.StringPtr("testString") + updatePlacementGroupOptionsModel.PlacementGroupPatch = placementGroupPatchModelAsPatch + updatePlacementGroupOptionsModel.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.CreateBareMetalServer(createBareMetalServerOptionsModel) + result, response, operationErr := vpcService.UpdatePlacementGroup(updatePlacementGroupOptionsModel) 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.CreateBareMetalServer(createBareMetalServerOptionsModel) + result, response, operationErr = vpcService.UpdatePlacementGroup(updatePlacementGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -43667,17 +44028,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateBareMetalServer(createBareMetalServerOptions *CreateBareMetalServerOptions)`, func() { + Describe(`UpdatePlacementGroup(updatePlacementGroupOptions *UpdatePlacementGroupOptions)`, func() { version := "testString" - createBareMetalServerPath := "/bare_metal_servers" + updatePlacementGroupPath := "/placement_groups/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(createBareMetalServerPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(updatePlacementGroupPath)) + Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -43702,11 +44063,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "name": "my-bare-metal-server", "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}], "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "deleting", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "disabled", "supported_modes": ["disabled"]}, "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"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + 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::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}`) })) }) - It(`Invoke CreateBareMetalServer successfully with retries`, func() { + It(`Invoke UpdatePlacementGroup successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -43716,99 +44077,28 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ImageIdentityByID model - imageIdentityModel := new(vpcv1.ImageIdentityByID) - imageIdentityModel.ID = core.StringPtr("72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") - - // Construct an instance of the KeyIdentityByID model - keyIdentityModel := new(vpcv1.KeyIdentityByID) - keyIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - - // Construct an instance of the BareMetalServerInitializationPrototype model - bareMetalServerInitializationPrototypeModel := new(vpcv1.BareMetalServerInitializationPrototype) - bareMetalServerInitializationPrototypeModel.Image = imageIdentityModel - bareMetalServerInitializationPrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} - bareMetalServerInitializationPrototypeModel.UserData = core.StringPtr("testString") - - // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model - networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) - networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // 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 SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the BareMetalServerPrimaryNetworkInterfacePrototype model - bareMetalServerPrimaryNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerPrimaryNetworkInterfacePrototype) - bareMetalServerPrimaryNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerPrimaryNetworkInterfacePrototypeModel.AllowedVlans = []int64{int64(4)} - bareMetalServerPrimaryNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerPrimaryNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("pci") - bareMetalServerPrimaryNetworkInterfacePrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-interface") - bareMetalServerPrimaryNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - bareMetalServerPrimaryNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerPrimaryNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - - // Construct an instance of the BareMetalServerProfileIdentityByName model - bareMetalServerProfileIdentityModel := new(vpcv1.BareMetalServerProfileIdentityByName) - bareMetalServerProfileIdentityModel.Name = core.StringPtr("bx2-metal-192x768") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype model - bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) - bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerNetworkInterfacePrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-interface") - bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the BareMetalServerTrustedPlatformModulePrototype model - bareMetalServerTrustedPlatformModulePrototypeModel := new(vpcv1.BareMetalServerTrustedPlatformModulePrototype) - bareMetalServerTrustedPlatformModulePrototypeModel.Mode = core.StringPtr("disabled") - - // Construct an instance of the VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b") + // Construct an instance of the PlacementGroupPatch model + placementGroupPatchModel := new(vpcv1.PlacementGroupPatch) + placementGroupPatchModel.Name = core.StringPtr("my-placement-group") + placementGroupPatchModelAsPatch, asPatchErr := placementGroupPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) - // Construct an instance of the CreateBareMetalServerOptions model - createBareMetalServerOptionsModel := new(vpcv1.CreateBareMetalServerOptions) - createBareMetalServerOptionsModel.Initialization = bareMetalServerInitializationPrototypeModel - createBareMetalServerOptionsModel.PrimaryNetworkInterface = bareMetalServerPrimaryNetworkInterfacePrototypeModel - createBareMetalServerOptionsModel.Profile = bareMetalServerProfileIdentityModel - createBareMetalServerOptionsModel.Zone = zoneIdentityModel - createBareMetalServerOptionsModel.EnableSecureBoot = core.BoolPtr(false) - createBareMetalServerOptionsModel.Name = core.StringPtr("my-bare-metal-server") - createBareMetalServerOptionsModel.NetworkInterfaces = []vpcv1.BareMetalServerNetworkInterfacePrototypeIntf{bareMetalServerNetworkInterfacePrototypeModel} - createBareMetalServerOptionsModel.ResourceGroup = resourceGroupIdentityModel - createBareMetalServerOptionsModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePrototypeModel - createBareMetalServerOptionsModel.VPC = vpcIdentityModel - createBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdatePlacementGroupOptions model + updatePlacementGroupOptionsModel := new(vpcv1.UpdatePlacementGroupOptions) + updatePlacementGroupOptionsModel.ID = core.StringPtr("testString") + updatePlacementGroupOptionsModel.PlacementGroupPatch = placementGroupPatchModelAsPatch + updatePlacementGroupOptionsModel.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.CreateBareMetalServerWithContext(ctx, createBareMetalServerOptionsModel) + _, _, operationErr := vpcService.UpdatePlacementGroupWithContext(ctx, updatePlacementGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateBareMetalServer(createBareMetalServerOptionsModel) + result, response, operationErr := vpcService.UpdatePlacementGroup(updatePlacementGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -43816,7 +44106,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreateBareMetalServerWithContext(ctx, createBareMetalServerOptionsModel) + _, _, operationErr = vpcService.UpdatePlacementGroupWithContext(ctx, updatePlacementGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -43830,8 +44120,8 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createBareMetalServerPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(updatePlacementGroupPath)) + Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -43853,11 +44143,11 @@ var _ = Describe(`VpcV1`, func() { 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", `{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "name": "my-bare-metal-server", "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}], "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "deleting", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "disabled", "supported_modes": ["disabled"]}, "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"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + 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::placement-group:r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "href": "https://us-south.iaas.cloud.ibm.com/v1/placement_groups/r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "id": "r018-418fe842-a3e9-47b9-a938-1aa5bd632871", "lifecycle_state": "stable", "name": "my-placement-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "placement_group", "strategy": "host_spread"}`) })) }) - It(`Invoke CreateBareMetalServer successfully`, func() { + It(`Invoke UpdatePlacementGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -43867,102 +44157,31 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreateBareMetalServer(nil) + result, response, operationErr := vpcService.UpdatePlacementGroup(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ImageIdentityByID model - imageIdentityModel := new(vpcv1.ImageIdentityByID) - imageIdentityModel.ID = core.StringPtr("72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") - - // Construct an instance of the KeyIdentityByID model - keyIdentityModel := new(vpcv1.KeyIdentityByID) - keyIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - - // Construct an instance of the BareMetalServerInitializationPrototype model - bareMetalServerInitializationPrototypeModel := new(vpcv1.BareMetalServerInitializationPrototype) - bareMetalServerInitializationPrototypeModel.Image = imageIdentityModel - bareMetalServerInitializationPrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} - bareMetalServerInitializationPrototypeModel.UserData = core.StringPtr("testString") - - // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model - networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) - networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // 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 SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the BareMetalServerPrimaryNetworkInterfacePrototype model - bareMetalServerPrimaryNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerPrimaryNetworkInterfacePrototype) - bareMetalServerPrimaryNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerPrimaryNetworkInterfacePrototypeModel.AllowedVlans = []int64{int64(4)} - bareMetalServerPrimaryNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerPrimaryNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("pci") - bareMetalServerPrimaryNetworkInterfacePrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-interface") - bareMetalServerPrimaryNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - bareMetalServerPrimaryNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerPrimaryNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - - // Construct an instance of the BareMetalServerProfileIdentityByName model - bareMetalServerProfileIdentityModel := new(vpcv1.BareMetalServerProfileIdentityByName) - bareMetalServerProfileIdentityModel.Name = core.StringPtr("bx2-metal-192x768") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype model - bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) - bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerNetworkInterfacePrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-interface") - bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the BareMetalServerTrustedPlatformModulePrototype model - bareMetalServerTrustedPlatformModulePrototypeModel := new(vpcv1.BareMetalServerTrustedPlatformModulePrototype) - bareMetalServerTrustedPlatformModulePrototypeModel.Mode = core.StringPtr("disabled") - - // Construct an instance of the VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b") + // Construct an instance of the PlacementGroupPatch model + placementGroupPatchModel := new(vpcv1.PlacementGroupPatch) + placementGroupPatchModel.Name = core.StringPtr("my-placement-group") + placementGroupPatchModelAsPatch, asPatchErr := placementGroupPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) - // Construct an instance of the CreateBareMetalServerOptions model - createBareMetalServerOptionsModel := new(vpcv1.CreateBareMetalServerOptions) - createBareMetalServerOptionsModel.Initialization = bareMetalServerInitializationPrototypeModel - createBareMetalServerOptionsModel.PrimaryNetworkInterface = bareMetalServerPrimaryNetworkInterfacePrototypeModel - createBareMetalServerOptionsModel.Profile = bareMetalServerProfileIdentityModel - createBareMetalServerOptionsModel.Zone = zoneIdentityModel - createBareMetalServerOptionsModel.EnableSecureBoot = core.BoolPtr(false) - createBareMetalServerOptionsModel.Name = core.StringPtr("my-bare-metal-server") - createBareMetalServerOptionsModel.NetworkInterfaces = []vpcv1.BareMetalServerNetworkInterfacePrototypeIntf{bareMetalServerNetworkInterfacePrototypeModel} - createBareMetalServerOptionsModel.ResourceGroup = resourceGroupIdentityModel - createBareMetalServerOptionsModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePrototypeModel - createBareMetalServerOptionsModel.VPC = vpcIdentityModel - createBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdatePlacementGroupOptions model + updatePlacementGroupOptionsModel := new(vpcv1.UpdatePlacementGroupOptions) + updatePlacementGroupOptionsModel.ID = core.StringPtr("testString") + updatePlacementGroupOptionsModel.PlacementGroupPatch = placementGroupPatchModelAsPatch + updatePlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateBareMetalServer(createBareMetalServerOptionsModel) + result, response, operationErr = vpcService.UpdatePlacementGroup(updatePlacementGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateBareMetalServer with error: Operation validation and request error`, func() { + It(`Invoke UpdatePlacementGroup with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -43971,100 +44190,29 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ImageIdentityByID model - imageIdentityModel := new(vpcv1.ImageIdentityByID) - imageIdentityModel.ID = core.StringPtr("72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") - - // Construct an instance of the KeyIdentityByID model - keyIdentityModel := new(vpcv1.KeyIdentityByID) - keyIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - - // Construct an instance of the BareMetalServerInitializationPrototype model - bareMetalServerInitializationPrototypeModel := new(vpcv1.BareMetalServerInitializationPrototype) - bareMetalServerInitializationPrototypeModel.Image = imageIdentityModel - bareMetalServerInitializationPrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} - bareMetalServerInitializationPrototypeModel.UserData = core.StringPtr("testString") - - // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model - networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) - networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // 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 SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the BareMetalServerPrimaryNetworkInterfacePrototype model - bareMetalServerPrimaryNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerPrimaryNetworkInterfacePrototype) - bareMetalServerPrimaryNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerPrimaryNetworkInterfacePrototypeModel.AllowedVlans = []int64{int64(4)} - bareMetalServerPrimaryNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerPrimaryNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("pci") - bareMetalServerPrimaryNetworkInterfacePrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-interface") - bareMetalServerPrimaryNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - bareMetalServerPrimaryNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerPrimaryNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - - // Construct an instance of the BareMetalServerProfileIdentityByName model - bareMetalServerProfileIdentityModel := new(vpcv1.BareMetalServerProfileIdentityByName) - bareMetalServerProfileIdentityModel.Name = core.StringPtr("bx2-metal-192x768") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype model - bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) - bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerNetworkInterfacePrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-interface") - bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the BareMetalServerTrustedPlatformModulePrototype model - bareMetalServerTrustedPlatformModulePrototypeModel := new(vpcv1.BareMetalServerTrustedPlatformModulePrototype) - bareMetalServerTrustedPlatformModulePrototypeModel.Mode = core.StringPtr("disabled") - - // Construct an instance of the VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b") + // Construct an instance of the PlacementGroupPatch model + placementGroupPatchModel := new(vpcv1.PlacementGroupPatch) + placementGroupPatchModel.Name = core.StringPtr("my-placement-group") + placementGroupPatchModelAsPatch, asPatchErr := placementGroupPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) - // Construct an instance of the CreateBareMetalServerOptions model - createBareMetalServerOptionsModel := new(vpcv1.CreateBareMetalServerOptions) - createBareMetalServerOptionsModel.Initialization = bareMetalServerInitializationPrototypeModel - createBareMetalServerOptionsModel.PrimaryNetworkInterface = bareMetalServerPrimaryNetworkInterfacePrototypeModel - createBareMetalServerOptionsModel.Profile = bareMetalServerProfileIdentityModel - createBareMetalServerOptionsModel.Zone = zoneIdentityModel - createBareMetalServerOptionsModel.EnableSecureBoot = core.BoolPtr(false) - createBareMetalServerOptionsModel.Name = core.StringPtr("my-bare-metal-server") - createBareMetalServerOptionsModel.NetworkInterfaces = []vpcv1.BareMetalServerNetworkInterfacePrototypeIntf{bareMetalServerNetworkInterfacePrototypeModel} - createBareMetalServerOptionsModel.ResourceGroup = resourceGroupIdentityModel - createBareMetalServerOptionsModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePrototypeModel - createBareMetalServerOptionsModel.VPC = vpcIdentityModel - createBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdatePlacementGroupOptions model + updatePlacementGroupOptionsModel := new(vpcv1.UpdatePlacementGroupOptions) + updatePlacementGroupOptionsModel.ID = core.StringPtr("testString") + updatePlacementGroupOptionsModel.PlacementGroupPatch = placementGroupPatchModelAsPatch + updatePlacementGroupOptionsModel.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.CreateBareMetalServer(createBareMetalServerOptionsModel) + result, response, operationErr := vpcService.UpdatePlacementGroup(updatePlacementGroupOptionsModel) 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 CreateBareMetalServerOptions model with no property values - createBareMetalServerOptionsModelNew := new(vpcv1.CreateBareMetalServerOptions) + // Construct a second instance of the UpdatePlacementGroupOptions model with no property values + updatePlacementGroupOptionsModelNew := new(vpcv1.UpdatePlacementGroupOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateBareMetalServer(createBareMetalServerOptionsModelNew) + result, response, operationErr = vpcService.UpdatePlacementGroup(updatePlacementGroupOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -44079,10 +44227,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke CreateBareMetalServer successfully`, func() { + It(`Invoke UpdatePlacementGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -44091,91 +44239,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ImageIdentityByID model - imageIdentityModel := new(vpcv1.ImageIdentityByID) - imageIdentityModel.ID = core.StringPtr("72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") - - // Construct an instance of the KeyIdentityByID model - keyIdentityModel := new(vpcv1.KeyIdentityByID) - keyIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - - // Construct an instance of the BareMetalServerInitializationPrototype model - bareMetalServerInitializationPrototypeModel := new(vpcv1.BareMetalServerInitializationPrototype) - bareMetalServerInitializationPrototypeModel.Image = imageIdentityModel - bareMetalServerInitializationPrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} - bareMetalServerInitializationPrototypeModel.UserData = core.StringPtr("testString") - - // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model - networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) - networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // 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 SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the BareMetalServerPrimaryNetworkInterfacePrototype model - bareMetalServerPrimaryNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerPrimaryNetworkInterfacePrototype) - bareMetalServerPrimaryNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerPrimaryNetworkInterfacePrototypeModel.AllowedVlans = []int64{int64(4)} - bareMetalServerPrimaryNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerPrimaryNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("pci") - bareMetalServerPrimaryNetworkInterfacePrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-interface") - bareMetalServerPrimaryNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - bareMetalServerPrimaryNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerPrimaryNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - - // Construct an instance of the BareMetalServerProfileIdentityByName model - bareMetalServerProfileIdentityModel := new(vpcv1.BareMetalServerProfileIdentityByName) - bareMetalServerProfileIdentityModel.Name = core.StringPtr("bx2-metal-192x768") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype model - bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) - bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerNetworkInterfacePrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-interface") - bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the BareMetalServerTrustedPlatformModulePrototype model - bareMetalServerTrustedPlatformModulePrototypeModel := new(vpcv1.BareMetalServerTrustedPlatformModulePrototype) - bareMetalServerTrustedPlatformModulePrototypeModel.Mode = core.StringPtr("disabled") - - // Construct an instance of the VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b") + // Construct an instance of the PlacementGroupPatch model + placementGroupPatchModel := new(vpcv1.PlacementGroupPatch) + placementGroupPatchModel.Name = core.StringPtr("my-placement-group") + placementGroupPatchModelAsPatch, asPatchErr := placementGroupPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) - // Construct an instance of the CreateBareMetalServerOptions model - createBareMetalServerOptionsModel := new(vpcv1.CreateBareMetalServerOptions) - createBareMetalServerOptionsModel.Initialization = bareMetalServerInitializationPrototypeModel - createBareMetalServerOptionsModel.PrimaryNetworkInterface = bareMetalServerPrimaryNetworkInterfacePrototypeModel - createBareMetalServerOptionsModel.Profile = bareMetalServerProfileIdentityModel - createBareMetalServerOptionsModel.Zone = zoneIdentityModel - createBareMetalServerOptionsModel.EnableSecureBoot = core.BoolPtr(false) - createBareMetalServerOptionsModel.Name = core.StringPtr("my-bare-metal-server") - createBareMetalServerOptionsModel.NetworkInterfaces = []vpcv1.BareMetalServerNetworkInterfacePrototypeIntf{bareMetalServerNetworkInterfacePrototypeModel} - createBareMetalServerOptionsModel.ResourceGroup = resourceGroupIdentityModel - createBareMetalServerOptionsModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePrototypeModel - createBareMetalServerOptionsModel.VPC = vpcIdentityModel - createBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdatePlacementGroupOptions model + updatePlacementGroupOptionsModel := new(vpcv1.UpdatePlacementGroupOptions) + updatePlacementGroupOptionsModel.ID = core.StringPtr("testString") + updatePlacementGroupOptionsModel.PlacementGroupPatch = placementGroupPatchModelAsPatch + updatePlacementGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.CreateBareMetalServer(createBareMetalServerOptionsModel) + result, response, operationErr := vpcService.UpdatePlacementGroup(updatePlacementGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -44187,25 +44264,27 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptions *CreateBareMetalServerConsoleAccessTokenOptions) - Operation response error`, func() { + Describe(`ListBareMetalServerProfiles(listBareMetalServerProfilesOptions *ListBareMetalServerProfilesOptions) - Operation response error`, func() { version := "testString" - createBareMetalServerConsoleAccessTokenPath := "/bare_metal_servers/testString/console_access_token" + listBareMetalServerProfilesPath := "/bare_metal_server/profiles" 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(createBareMetalServerConsoleAccessTokenPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerProfilesPath)) + 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(10))})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateBareMetalServerConsoleAccessToken with error: Operation response processing error`, func() { + It(`Invoke ListBareMetalServerProfiles with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -44214,21 +44293,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the CreateBareMetalServerConsoleAccessTokenOptions model - createBareMetalServerConsoleAccessTokenOptionsModel := new(vpcv1.CreateBareMetalServerConsoleAccessTokenOptions) - createBareMetalServerConsoleAccessTokenOptionsModel.BareMetalServerID = core.StringPtr("testString") - createBareMetalServerConsoleAccessTokenOptionsModel.ConsoleType = core.StringPtr("serial") - createBareMetalServerConsoleAccessTokenOptionsModel.Force = core.BoolPtr(false) - createBareMetalServerConsoleAccessTokenOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBareMetalServerProfilesOptions model + listBareMetalServerProfilesOptionsModel := new(vpcv1.ListBareMetalServerProfilesOptions) + listBareMetalServerProfilesOptionsModel.Start = core.StringPtr("testString") + listBareMetalServerProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBareMetalServerProfilesOptionsModel.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.CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptionsModel) + result, response, operationErr := vpcService.ListBareMetalServerProfiles(listBareMetalServerProfilesOptionsModel) 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.CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptionsModel) + result, response, operationErr = vpcService.ListBareMetalServerProfiles(listBareMetalServerProfilesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -44238,46 +44316,32 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptions *CreateBareMetalServerConsoleAccessTokenOptions)`, func() { + Describe(`ListBareMetalServerProfiles(listBareMetalServerProfilesOptions *ListBareMetalServerProfilesOptions)`, func() { version := "testString" - createBareMetalServerConsoleAccessTokenPath := "/bare_metal_servers/testString/console_access_token" + listBareMetalServerProfilesPath := "/bare_metal_server/profiles" 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(createBareMetalServerConsoleAccessTokenPath)) - 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.EscapedPath()).To(Equal(listBareMetalServerProfilesPath)) + 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(10))})) // 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", `{"access_token": "VGhpcyBJcyBhIHRva2Vu", "console_type": "serial", "created_at": "2020-07-27T21:50:14.000Z", "expires_at": "2020-07-27T21:51:14.000Z", "force": false, "href": "wss://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/console?access_token=VGhpcyBJcyBhIHRva2Vu"}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "profiles": [{"bandwidth": {"type": "fixed", "value": 20000}, "console_types": {"type": "enum", "values": ["serial"]}, "cpu_architecture": {"default": "amd64", "type": "fixed", "value": "amd64"}, "cpu_core_count": {"type": "fixed", "value": 80}, "cpu_socket_count": {"type": "fixed", "value": 4}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "fcp", "type": "enum", "values": ["fcp"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "memory": {"type": "fixed", "value": 16}, "name": "bx2-metal-192x768", "network_attachment_count": {"max": 128, "min": 1, "type": "range"}, "network_interface_count": {"max": 128, "min": 1, "type": "range"}, "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"type": "enum", "values": ["disabled"]}, "virtual_network_interfaces_supported": {"type": "fixed", "value": false}}], "total_count": 132}`) })) }) - It(`Invoke CreateBareMetalServerConsoleAccessToken successfully with retries`, func() { + It(`Invoke ListBareMetalServerProfiles successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -44287,23 +44351,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the CreateBareMetalServerConsoleAccessTokenOptions model - createBareMetalServerConsoleAccessTokenOptionsModel := new(vpcv1.CreateBareMetalServerConsoleAccessTokenOptions) - createBareMetalServerConsoleAccessTokenOptionsModel.BareMetalServerID = core.StringPtr("testString") - createBareMetalServerConsoleAccessTokenOptionsModel.ConsoleType = core.StringPtr("serial") - createBareMetalServerConsoleAccessTokenOptionsModel.Force = core.BoolPtr(false) - createBareMetalServerConsoleAccessTokenOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBareMetalServerProfilesOptions model + listBareMetalServerProfilesOptionsModel := new(vpcv1.ListBareMetalServerProfilesOptions) + listBareMetalServerProfilesOptionsModel.Start = core.StringPtr("testString") + listBareMetalServerProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBareMetalServerProfilesOptionsModel.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.CreateBareMetalServerConsoleAccessTokenWithContext(ctx, createBareMetalServerConsoleAccessTokenOptionsModel) + _, _, operationErr := vpcService.ListBareMetalServerProfilesWithContext(ctx, listBareMetalServerProfilesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptionsModel) + result, response, operationErr := vpcService.ListBareMetalServerProfiles(listBareMetalServerProfilesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -44311,7 +44374,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreateBareMetalServerConsoleAccessTokenWithContext(ctx, createBareMetalServerConsoleAccessTokenOptionsModel) + _, _, operationErr = vpcService.ListBareMetalServerProfilesWithContext(ctx, listBareMetalServerProfilesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -44325,34 +44388,20 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createBareMetalServerConsoleAccessTokenPath)) - 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.EscapedPath()).To(Equal(listBareMetalServerProfilesPath)) + 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(10))})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"access_token": "VGhpcyBJcyBhIHRva2Vu", "console_type": "serial", "created_at": "2020-07-27T21:50:14.000Z", "expires_at": "2020-07-27T21:51:14.000Z", "force": false, "href": "wss://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/console?access_token=VGhpcyBJcyBhIHRva2Vu"}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "profiles": [{"bandwidth": {"type": "fixed", "value": 20000}, "console_types": {"type": "enum", "values": ["serial"]}, "cpu_architecture": {"default": "amd64", "type": "fixed", "value": "amd64"}, "cpu_core_count": {"type": "fixed", "value": 80}, "cpu_socket_count": {"type": "fixed", "value": 4}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "fcp", "type": "enum", "values": ["fcp"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "memory": {"type": "fixed", "value": 16}, "name": "bx2-metal-192x768", "network_attachment_count": {"max": 128, "min": 1, "type": "range"}, "network_interface_count": {"max": 128, "min": 1, "type": "range"}, "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"type": "enum", "values": ["disabled"]}, "virtual_network_interfaces_supported": {"type": "fixed", "value": false}}], "total_count": 132}`) })) }) - It(`Invoke CreateBareMetalServerConsoleAccessToken successfully`, func() { + It(`Invoke ListBareMetalServerProfiles successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -44362,26 +44411,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreateBareMetalServerConsoleAccessToken(nil) + result, response, operationErr := vpcService.ListBareMetalServerProfiles(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the CreateBareMetalServerConsoleAccessTokenOptions model - createBareMetalServerConsoleAccessTokenOptionsModel := new(vpcv1.CreateBareMetalServerConsoleAccessTokenOptions) - createBareMetalServerConsoleAccessTokenOptionsModel.BareMetalServerID = core.StringPtr("testString") - createBareMetalServerConsoleAccessTokenOptionsModel.ConsoleType = core.StringPtr("serial") - createBareMetalServerConsoleAccessTokenOptionsModel.Force = core.BoolPtr(false) - createBareMetalServerConsoleAccessTokenOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBareMetalServerProfilesOptions model + listBareMetalServerProfilesOptionsModel := new(vpcv1.ListBareMetalServerProfilesOptions) + listBareMetalServerProfilesOptionsModel.Start = core.StringPtr("testString") + listBareMetalServerProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBareMetalServerProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptionsModel) + result, response, operationErr = vpcService.ListBareMetalServerProfiles(listBareMetalServerProfilesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateBareMetalServerConsoleAccessToken with error: Operation validation and request error`, func() { + It(`Invoke ListBareMetalServerProfiles with error: Operation request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -44390,27 +44438,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the CreateBareMetalServerConsoleAccessTokenOptions model - createBareMetalServerConsoleAccessTokenOptionsModel := new(vpcv1.CreateBareMetalServerConsoleAccessTokenOptions) - createBareMetalServerConsoleAccessTokenOptionsModel.BareMetalServerID = core.StringPtr("testString") - createBareMetalServerConsoleAccessTokenOptionsModel.ConsoleType = core.StringPtr("serial") - createBareMetalServerConsoleAccessTokenOptionsModel.Force = core.BoolPtr(false) - createBareMetalServerConsoleAccessTokenOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBareMetalServerProfilesOptions model + listBareMetalServerProfilesOptionsModel := new(vpcv1.ListBareMetalServerProfilesOptions) + listBareMetalServerProfilesOptionsModel.Start = core.StringPtr("testString") + listBareMetalServerProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBareMetalServerProfilesOptionsModel.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.CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptionsModel) + result, response, operationErr := vpcService.ListBareMetalServerProfiles(listBareMetalServerProfilesOptionsModel) 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 CreateBareMetalServerConsoleAccessTokenOptions model with no property values - createBareMetalServerConsoleAccessTokenOptionsModelNew := new(vpcv1.CreateBareMetalServerConsoleAccessTokenOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -44425,7 +44465,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke CreateBareMetalServerConsoleAccessToken successfully`, func() { + It(`Invoke ListBareMetalServerProfiles successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -44434,15 +44474,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the CreateBareMetalServerConsoleAccessTokenOptions model - createBareMetalServerConsoleAccessTokenOptionsModel := new(vpcv1.CreateBareMetalServerConsoleAccessTokenOptions) - createBareMetalServerConsoleAccessTokenOptionsModel.BareMetalServerID = core.StringPtr("testString") - createBareMetalServerConsoleAccessTokenOptionsModel.ConsoleType = core.StringPtr("serial") - createBareMetalServerConsoleAccessTokenOptionsModel.Force = core.BoolPtr(false) - createBareMetalServerConsoleAccessTokenOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBareMetalServerProfilesOptions model + listBareMetalServerProfilesOptionsModel := new(vpcv1.ListBareMetalServerProfilesOptions) + listBareMetalServerProfilesOptionsModel.Start = core.StringPtr("testString") + listBareMetalServerProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBareMetalServerProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptionsModel) + result, response, operationErr := vpcService.ListBareMetalServerProfiles(listBareMetalServerProfilesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -44453,17 +44492,118 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(vpcv1.BareMetalServerProfileCollection) + nextObject := new(vpcv1.BareMetalServerProfileCollectionNext) + 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.BareMetalServerProfileCollection) + + 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.BareMetalServerProfileCollection) + nextObject := new(vpcv1.BareMetalServerProfileCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { + BeforeEach(func() { + var requestNumber int = 0 + 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(listBareMetalServerProfilesPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"profiles":[{"bandwidth":{"type":"fixed","value":20000},"console_types":{"type":"enum","values":["serial"]},"cpu_architecture":{"default":"amd64","type":"fixed","value":"amd64"},"cpu_core_count":{"type":"fixed","value":80},"cpu_socket_count":{"type":"fixed","value":4},"disks":[{"quantity":{"type":"fixed","value":4},"size":{"type":"fixed","value":100},"supported_interface_types":{"default":"fcp","type":"enum","values":["fcp"]}}],"family":"balanced","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768","memory":{"type":"fixed","value":16},"name":"bx2-metal-192x768","network_attachment_count":{"max":128,"min":1,"type":"range"},"network_interface_count":{"max":128,"min":1,"type":"range"},"os_architecture":{"default":"amd64","type":"enum","values":["amd64"]},"resource_type":"bare_metal_server_profile","supported_trusted_platform_module_modes":{"type":"enum","values":["disabled"]},"virtual_network_interfaces_supported":{"type":"fixed","value":false}}]}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"profiles":[{"bandwidth":{"type":"fixed","value":20000},"console_types":{"type":"enum","values":["serial"]},"cpu_architecture":{"default":"amd64","type":"fixed","value":"amd64"},"cpu_core_count":{"type":"fixed","value":80},"cpu_socket_count":{"type":"fixed","value":4},"disks":[{"quantity":{"type":"fixed","value":4},"size":{"type":"fixed","value":100},"supported_interface_types":{"default":"fcp","type":"enum","values":["fcp"]}}],"family":"balanced","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768","memory":{"type":"fixed","value":16},"name":"bx2-metal-192x768","network_attachment_count":{"max":128,"min":1,"type":"range"},"network_interface_count":{"max":128,"min":1,"type":"range"},"os_architecture":{"default":"amd64","type":"enum","values":["amd64"]},"resource_type":"bare_metal_server_profile","supported_trusted_platform_module_modes":{"type":"enum","values":["disabled"]},"virtual_network_interfaces_supported":{"type":"fixed","value":false}}]}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use BareMetalServerProfilesPager.GetNext 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()) + + listBareMetalServerProfilesOptionsModel := &vpcv1.ListBareMetalServerProfilesOptions{ + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewBareMetalServerProfilesPager(listBareMetalServerProfilesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.BareMetalServerProfile + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) + }) + It(`Use BareMetalServerProfilesPager.GetAll 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()) + + listBareMetalServerProfilesOptionsModel := &vpcv1.ListBareMetalServerProfilesOptions{ + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewBareMetalServerProfilesPager(listBareMetalServerProfilesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) + }) + }) }) - Describe(`ListBareMetalServerDisks(listBareMetalServerDisksOptions *ListBareMetalServerDisksOptions) - Operation response error`, func() { + Describe(`GetBareMetalServerProfile(getBareMetalServerProfileOptions *GetBareMetalServerProfileOptions) - Operation response error`, func() { version := "testString" - listBareMetalServerDisksPath := "/bare_metal_servers/testString/disks" + getBareMetalServerProfilePath := "/bare_metal_server/profiles/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(listBareMetalServerDisksPath)) + Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerProfilePath)) 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))})) @@ -44472,7 +44612,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListBareMetalServerDisks with error: Operation response processing error`, func() { + It(`Invoke GetBareMetalServerProfile with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -44481,19 +44621,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBareMetalServerDisksOptions model - listBareMetalServerDisksOptionsModel := new(vpcv1.ListBareMetalServerDisksOptions) - listBareMetalServerDisksOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerDisksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBareMetalServerProfileOptions model + getBareMetalServerProfileOptionsModel := new(vpcv1.GetBareMetalServerProfileOptions) + getBareMetalServerProfileOptionsModel.Name = core.StringPtr("testString") + getBareMetalServerProfileOptionsModel.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.ListBareMetalServerDisks(listBareMetalServerDisksOptionsModel) + result, response, operationErr := vpcService.GetBareMetalServerProfile(getBareMetalServerProfileOptionsModel) 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.ListBareMetalServerDisks(listBareMetalServerDisksOptionsModel) + result, response, operationErr = vpcService.GetBareMetalServerProfile(getBareMetalServerProfileOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -44503,16 +44643,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListBareMetalServerDisks(listBareMetalServerDisksOptions *ListBareMetalServerDisksOptions)`, func() { + Describe(`GetBareMetalServerProfile(getBareMetalServerProfileOptions *GetBareMetalServerProfileOptions)`, func() { version := "testString" - listBareMetalServerDisksPath := "/bare_metal_servers/testString/disks" + getBareMetalServerProfilePath := "/bare_metal_server/profiles/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(listBareMetalServerDisksPath)) + Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerProfilePath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -44523,10 +44663,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}]}`) + fmt.Fprintf(res, "%s", `{"bandwidth": {"type": "fixed", "value": 20000}, "console_types": {"type": "enum", "values": ["serial"]}, "cpu_architecture": {"default": "amd64", "type": "fixed", "value": "amd64"}, "cpu_core_count": {"type": "fixed", "value": 80}, "cpu_socket_count": {"type": "fixed", "value": 4}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "fcp", "type": "enum", "values": ["fcp"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "memory": {"type": "fixed", "value": 16}, "name": "bx2-metal-192x768", "network_attachment_count": {"max": 128, "min": 1, "type": "range"}, "network_interface_count": {"max": 128, "min": 1, "type": "range"}, "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"type": "enum", "values": ["disabled"]}, "virtual_network_interfaces_supported": {"type": "fixed", "value": false}}`) })) }) - It(`Invoke ListBareMetalServerDisks successfully with retries`, func() { + It(`Invoke GetBareMetalServerProfile successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -44536,21 +44676,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListBareMetalServerDisksOptions model - listBareMetalServerDisksOptionsModel := new(vpcv1.ListBareMetalServerDisksOptions) - listBareMetalServerDisksOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerDisksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBareMetalServerProfileOptions model + getBareMetalServerProfileOptionsModel := new(vpcv1.GetBareMetalServerProfileOptions) + getBareMetalServerProfileOptionsModel.Name = core.StringPtr("testString") + getBareMetalServerProfileOptionsModel.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.ListBareMetalServerDisksWithContext(ctx, listBareMetalServerDisksOptionsModel) + _, _, operationErr := vpcService.GetBareMetalServerProfileWithContext(ctx, getBareMetalServerProfileOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListBareMetalServerDisks(listBareMetalServerDisksOptionsModel) + result, response, operationErr := vpcService.GetBareMetalServerProfile(getBareMetalServerProfileOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -44558,7 +44698,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListBareMetalServerDisksWithContext(ctx, listBareMetalServerDisksOptionsModel) + _, _, operationErr = vpcService.GetBareMetalServerProfileWithContext(ctx, getBareMetalServerProfileOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -44572,7 +44712,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerDisksPath)) + Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerProfilePath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -44580,10 +44720,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}]}`) + fmt.Fprintf(res, "%s", `{"bandwidth": {"type": "fixed", "value": 20000}, "console_types": {"type": "enum", "values": ["serial"]}, "cpu_architecture": {"default": "amd64", "type": "fixed", "value": "amd64"}, "cpu_core_count": {"type": "fixed", "value": 80}, "cpu_socket_count": {"type": "fixed", "value": 4}, "disks": [{"quantity": {"type": "fixed", "value": 4}, "size": {"type": "fixed", "value": 100}, "supported_interface_types": {"default": "fcp", "type": "enum", "values": ["fcp"]}}], "family": "balanced", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "memory": {"type": "fixed", "value": 16}, "name": "bx2-metal-192x768", "network_attachment_count": {"max": 128, "min": 1, "type": "range"}, "network_interface_count": {"max": 128, "min": 1, "type": "range"}, "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"type": "enum", "values": ["disabled"]}, "virtual_network_interfaces_supported": {"type": "fixed", "value": false}}`) })) }) - It(`Invoke ListBareMetalServerDisks successfully`, func() { + It(`Invoke GetBareMetalServerProfile successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -44593,24 +44733,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListBareMetalServerDisks(nil) + result, response, operationErr := vpcService.GetBareMetalServerProfile(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListBareMetalServerDisksOptions model - listBareMetalServerDisksOptionsModel := new(vpcv1.ListBareMetalServerDisksOptions) - listBareMetalServerDisksOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerDisksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBareMetalServerProfileOptions model + getBareMetalServerProfileOptionsModel := new(vpcv1.GetBareMetalServerProfileOptions) + getBareMetalServerProfileOptionsModel.Name = core.StringPtr("testString") + getBareMetalServerProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListBareMetalServerDisks(listBareMetalServerDisksOptionsModel) + result, response, operationErr = vpcService.GetBareMetalServerProfile(getBareMetalServerProfileOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListBareMetalServerDisks with error: Operation validation and request error`, func() { + It(`Invoke GetBareMetalServerProfile with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -44619,22 +44759,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBareMetalServerDisksOptions model - listBareMetalServerDisksOptionsModel := new(vpcv1.ListBareMetalServerDisksOptions) - listBareMetalServerDisksOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerDisksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBareMetalServerProfileOptions model + getBareMetalServerProfileOptionsModel := new(vpcv1.GetBareMetalServerProfileOptions) + getBareMetalServerProfileOptionsModel.Name = core.StringPtr("testString") + getBareMetalServerProfileOptionsModel.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.ListBareMetalServerDisks(listBareMetalServerDisksOptionsModel) + result, response, operationErr := vpcService.GetBareMetalServerProfile(getBareMetalServerProfileOptionsModel) 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 ListBareMetalServerDisksOptions model with no property values - listBareMetalServerDisksOptionsModelNew := new(vpcv1.ListBareMetalServerDisksOptions) + // Construct a second instance of the GetBareMetalServerProfileOptions model with no property values + getBareMetalServerProfileOptionsModelNew := new(vpcv1.GetBareMetalServerProfileOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListBareMetalServerDisks(listBareMetalServerDisksOptionsModelNew) + result, response, operationErr = vpcService.GetBareMetalServerProfile(getBareMetalServerProfileOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -44652,7 +44792,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListBareMetalServerDisks successfully`, func() { + It(`Invoke GetBareMetalServerProfile successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -44661,13 +44801,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBareMetalServerDisksOptions model - listBareMetalServerDisksOptionsModel := new(vpcv1.ListBareMetalServerDisksOptions) - listBareMetalServerDisksOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerDisksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBareMetalServerProfileOptions model + getBareMetalServerProfileOptionsModel := new(vpcv1.GetBareMetalServerProfileOptions) + getBareMetalServerProfileOptionsModel.Name = core.StringPtr("testString") + getBareMetalServerProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListBareMetalServerDisks(listBareMetalServerDisksOptionsModel) + result, response, operationErr := vpcService.GetBareMetalServerProfile(getBareMetalServerProfileOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -44679,25 +44819,32 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetBareMetalServerDisk(getBareMetalServerDiskOptions *GetBareMetalServerDiskOptions) - Operation response error`, func() { + Describe(`ListBareMetalServers(listBareMetalServersOptions *ListBareMetalServersOptions) - Operation response error`, func() { version := "testString" - getBareMetalServerDiskPath := "/bare_metal_servers/testString/disks/testString" + listBareMetalServersPath := "/bare_metal_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(getBareMetalServerDiskPath)) + Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServersPath)) 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(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b"})) + Expect(req.URL.Query()["vpc.name"]).To(Equal([]string{"my-vpc"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetBareMetalServerDisk with error: Operation response processing error`, func() { + It(`Invoke ListBareMetalServers with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -44706,20 +44853,25 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBareMetalServerDiskOptions model - getBareMetalServerDiskOptionsModel := new(vpcv1.GetBareMetalServerDiskOptions) - getBareMetalServerDiskOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerDiskOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBareMetalServersOptions model + listBareMetalServersOptionsModel := new(vpcv1.ListBareMetalServersOptions) + listBareMetalServersOptionsModel.Start = core.StringPtr("testString") + listBareMetalServersOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBareMetalServersOptionsModel.ResourceGroupID = core.StringPtr("testString") + listBareMetalServersOptionsModel.Name = core.StringPtr("testString") + listBareMetalServersOptionsModel.VPCID = core.StringPtr("testString") + listBareMetalServersOptionsModel.VPCCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b") + listBareMetalServersOptionsModel.VPCName = core.StringPtr("my-vpc") + listBareMetalServersOptionsModel.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.GetBareMetalServerDisk(getBareMetalServerDiskOptionsModel) + result, response, operationErr := vpcService.ListBareMetalServers(listBareMetalServersOptionsModel) 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.GetBareMetalServerDisk(getBareMetalServerDiskOptionsModel) + result, response, operationErr = vpcService.ListBareMetalServers(listBareMetalServersOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -44729,30 +44881,37 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetBareMetalServerDisk(getBareMetalServerDiskOptions *GetBareMetalServerDiskOptions)`, func() { + Describe(`ListBareMetalServers(listBareMetalServersOptions *ListBareMetalServersOptions)`, func() { version := "testString" - getBareMetalServerDiskPath := "/bare_metal_servers/testString/disks/testString" + listBareMetalServersPath := "/bare_metal_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(getBareMetalServerDiskPath)) + Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServersPath)) 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(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b"})) + Expect(req.URL.Query()["vpc.name"]).To(Equal([]string{"my-vpc"})) // 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", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}`) + fmt.Fprintf(res, "%s", `{"bare_metal_servers": [{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "name": "my-bare-metal-server", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"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"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"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"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}], "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"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"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"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"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "deleting", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "disabled", "supported_modes": ["disabled"]}, "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"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) })) }) - It(`Invoke GetBareMetalServerDisk successfully with retries`, func() { + It(`Invoke ListBareMetalServers successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -44762,22 +44921,27 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetBareMetalServerDiskOptions model - getBareMetalServerDiskOptionsModel := new(vpcv1.GetBareMetalServerDiskOptions) - getBareMetalServerDiskOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerDiskOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBareMetalServersOptions model + listBareMetalServersOptionsModel := new(vpcv1.ListBareMetalServersOptions) + listBareMetalServersOptionsModel.Start = core.StringPtr("testString") + listBareMetalServersOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBareMetalServersOptionsModel.ResourceGroupID = core.StringPtr("testString") + listBareMetalServersOptionsModel.Name = core.StringPtr("testString") + listBareMetalServersOptionsModel.VPCID = core.StringPtr("testString") + listBareMetalServersOptionsModel.VPCCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b") + listBareMetalServersOptionsModel.VPCName = core.StringPtr("my-vpc") + listBareMetalServersOptionsModel.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.GetBareMetalServerDiskWithContext(ctx, getBareMetalServerDiskOptionsModel) + _, _, operationErr := vpcService.ListBareMetalServersWithContext(ctx, listBareMetalServersOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetBareMetalServerDisk(getBareMetalServerDiskOptionsModel) + result, response, operationErr := vpcService.ListBareMetalServers(listBareMetalServersOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -44785,7 +44949,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetBareMetalServerDiskWithContext(ctx, getBareMetalServerDiskOptionsModel) + _, _, operationErr = vpcService.ListBareMetalServersWithContext(ctx, listBareMetalServersOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -44799,18 +44963,25 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerDiskPath)) + Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServersPath)) 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(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b"})) + Expect(req.URL.Query()["vpc.name"]).To(Equal([]string{"my-vpc"})) // 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/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}`) + fmt.Fprintf(res, "%s", `{"bare_metal_servers": [{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "name": "my-bare-metal-server", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"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"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"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"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}], "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"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"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"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"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "deleting", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "disabled", "supported_modes": ["disabled"]}, "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"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) })) }) - It(`Invoke GetBareMetalServerDisk successfully`, func() { + It(`Invoke ListBareMetalServers successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -44820,25 +44991,30 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetBareMetalServerDisk(nil) + result, response, operationErr := vpcService.ListBareMetalServers(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetBareMetalServerDiskOptions model - getBareMetalServerDiskOptionsModel := new(vpcv1.GetBareMetalServerDiskOptions) - getBareMetalServerDiskOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerDiskOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBareMetalServersOptions model + listBareMetalServersOptionsModel := new(vpcv1.ListBareMetalServersOptions) + listBareMetalServersOptionsModel.Start = core.StringPtr("testString") + listBareMetalServersOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBareMetalServersOptionsModel.ResourceGroupID = core.StringPtr("testString") + listBareMetalServersOptionsModel.Name = core.StringPtr("testString") + listBareMetalServersOptionsModel.VPCID = core.StringPtr("testString") + listBareMetalServersOptionsModel.VPCCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b") + listBareMetalServersOptionsModel.VPCName = core.StringPtr("my-vpc") + listBareMetalServersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetBareMetalServerDisk(getBareMetalServerDiskOptionsModel) + result, response, operationErr = vpcService.ListBareMetalServers(listBareMetalServersOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetBareMetalServerDisk with error: Operation validation and request error`, func() { + It(`Invoke ListBareMetalServers with error: Operation request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -44847,26 +45023,24 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBareMetalServerDiskOptions model - getBareMetalServerDiskOptionsModel := new(vpcv1.GetBareMetalServerDiskOptions) - getBareMetalServerDiskOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerDiskOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBareMetalServersOptions model + listBareMetalServersOptionsModel := new(vpcv1.ListBareMetalServersOptions) + listBareMetalServersOptionsModel.Start = core.StringPtr("testString") + listBareMetalServersOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBareMetalServersOptionsModel.ResourceGroupID = core.StringPtr("testString") + listBareMetalServersOptionsModel.Name = core.StringPtr("testString") + listBareMetalServersOptionsModel.VPCID = core.StringPtr("testString") + listBareMetalServersOptionsModel.VPCCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b") + listBareMetalServersOptionsModel.VPCName = core.StringPtr("my-vpc") + listBareMetalServersOptionsModel.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.GetBareMetalServerDisk(getBareMetalServerDiskOptionsModel) + result, response, operationErr := vpcService.ListBareMetalServers(listBareMetalServersOptionsModel) 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 GetBareMetalServerDiskOptions model with no property values - getBareMetalServerDiskOptionsModelNew := new(vpcv1.GetBareMetalServerDiskOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetBareMetalServerDisk(getBareMetalServerDiskOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -44881,7 +45055,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetBareMetalServerDisk successfully`, func() { + It(`Invoke ListBareMetalServers successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -44890,14 +45064,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBareMetalServerDiskOptions model - getBareMetalServerDiskOptionsModel := new(vpcv1.GetBareMetalServerDiskOptions) - getBareMetalServerDiskOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerDiskOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBareMetalServersOptions model + listBareMetalServersOptionsModel := new(vpcv1.ListBareMetalServersOptions) + listBareMetalServersOptionsModel.Start = core.StringPtr("testString") + listBareMetalServersOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBareMetalServersOptionsModel.ResourceGroupID = core.StringPtr("testString") + listBareMetalServersOptionsModel.Name = core.StringPtr("testString") + listBareMetalServersOptionsModel.VPCID = core.StringPtr("testString") + listBareMetalServersOptionsModel.VPCCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b") + listBareMetalServersOptionsModel.VPCName = core.StringPtr("my-vpc") + listBareMetalServersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetBareMetalServerDisk(getBareMetalServerDiskOptionsModel) + result, response, operationErr := vpcService.ListBareMetalServers(listBareMetalServersOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -44908,26 +45087,137 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(vpcv1.BareMetalServerCollection) + nextObject := new(vpcv1.BareMetalServerCollectionNext) + 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.BareMetalServerCollection) + + 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.BareMetalServerCollection) + nextObject := new(vpcv1.BareMetalServerCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { + BeforeEach(func() { + var requestNumber int = 0 + 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(listBareMetalServersPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"bare_metal_servers":[{"bandwidth":20000,"boot_target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-bare-metal-server-disk","resource_type":"bare_metal_server_disk"},"cpu":{"architecture":"amd64","core_count":80,"socket_count":4,"threads_per_core":2},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a","disks":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","interface_type":"fcp","name":"my-bare-metal-server-disk","resource_type":"bare_metal_server_disk","size":100}],"enable_secure_boot":false,"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","memory":1536,"name":"my-bare-metal-server","network_attachments":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-attachment","primary_ip":{"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"},"resource_type":"bare_metal_server_network_attachment","subnet":{"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"}}],"network_interfaces":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-bare-metal-server-network-interface","primary_ip":{"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"},"resource_type":"network_interface","subnet":{"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"}}],"primary_network_attachment":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-attachment","primary_ip":{"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"},"resource_type":"bare_metal_server_network_attachment","subnet":{"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"}},"primary_network_interface":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-bare-metal-server-network-interface","primary_ip":{"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"},"resource_type":"network_interface","subnet":{"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"}},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768","name":"bx2-metal-192x768","resource_type":"bare_metal_server_profile"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"bare_metal_server","status":"deleting","status_reasons":[{"code":"cannot_start_capacity","message":"The bare metal server cannot start as there is no more capacity in this\\nzone for a bare metal server with the requested profile.","more_info":"https://console.bluemix.net/docs/iaas/bare_metal_server.html"}],"trusted_platform_module":{"enabled":true,"mode":"disabled","supported_modes":["disabled"]},"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"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}]}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"bare_metal_servers":[{"bandwidth":20000,"boot_target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-bare-metal-server-disk","resource_type":"bare_metal_server_disk"},"cpu":{"architecture":"amd64","core_count":80,"socket_count":4,"threads_per_core":2},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a","disks":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","interface_type":"fcp","name":"my-bare-metal-server-disk","resource_type":"bare_metal_server_disk","size":100}],"enable_secure_boot":false,"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","lifecycle_reasons":[{"code":"resource_suspended_by_provider","message":"The resource has been suspended. Contact IBM support with the CRN for next steps.","more_info":"https://cloud.ibm.com/apidocs/vpc#resource-suspension"}],"lifecycle_state":"stable","memory":1536,"name":"my-bare-metal-server","network_attachments":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-attachment","primary_ip":{"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"},"resource_type":"bare_metal_server_network_attachment","subnet":{"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"}}],"network_interfaces":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-bare-metal-server-network-interface","primary_ip":{"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"},"resource_type":"network_interface","subnet":{"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"}}],"primary_network_attachment":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","name":"my-bare-metal-server-network-attachment","primary_ip":{"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"},"resource_type":"bare_metal_server_network_attachment","subnet":{"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"}},"primary_network_interface":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-bare-metal-server-network-interface","primary_ip":{"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"},"resource_type":"network_interface","subnet":{"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"}},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768","name":"bx2-metal-192x768","resource_type":"bare_metal_server_profile"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"bare_metal_server","status":"deleting","status_reasons":[{"code":"cannot_start_capacity","message":"The bare metal server cannot start as there is no more capacity in this\\nzone for a bare metal server with the requested profile.","more_info":"https://console.bluemix.net/docs/iaas/bare_metal_server.html"}],"trusted_platform_module":{"enabled":true,"mode":"disabled","supported_modes":["disabled"]},"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"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}]}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use BareMetalServersPager.GetNext 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()) + + listBareMetalServersOptionsModel := &vpcv1.ListBareMetalServersOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + Name: core.StringPtr("testString"), + VPCID: core.StringPtr("testString"), + VPCCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b"), + VPCName: core.StringPtr("my-vpc"), + } + + pager, err := vpcService.NewBareMetalServersPager(listBareMetalServersOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.BareMetalServer + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) + }) + It(`Use BareMetalServersPager.GetAll 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()) + + listBareMetalServersOptionsModel := &vpcv1.ListBareMetalServersOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + Name: core.StringPtr("testString"), + VPCID: core.StringPtr("testString"), + VPCCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b"), + VPCName: core.StringPtr("my-vpc"), + } + + pager, err := vpcService.NewBareMetalServersPager(listBareMetalServersOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) + }) + }) }) - Describe(`UpdateBareMetalServerDisk(updateBareMetalServerDiskOptions *UpdateBareMetalServerDiskOptions) - Operation response error`, func() { + Describe(`CreateBareMetalServer(createBareMetalServerOptions *CreateBareMetalServerOptions) - Operation response error`, func() { version := "testString" - updateBareMetalServerDiskPath := "/bare_metal_servers/testString/disks/testString" + createBareMetalServerPath := "/bare_metal_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(updateBareMetalServerDiskPath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(createBareMetalServerPath)) + 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(200) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateBareMetalServerDisk with error: Operation response processing error`, func() { + It(`Invoke CreateBareMetalServer with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -44936,27 +45226,112 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the BareMetalServerDiskPatch model - bareMetalServerDiskPatchModel := new(vpcv1.BareMetalServerDiskPatch) - bareMetalServerDiskPatchModel.Name = core.StringPtr("my-bare-metal-server-disk-updated") - bareMetalServerDiskPatchModelAsPatch, asPatchErr := bareMetalServerDiskPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the ImageIdentityByID model + imageIdentityModel := new(vpcv1.ImageIdentityByID) + imageIdentityModel.ID = core.StringPtr("72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") - // Construct an instance of the UpdateBareMetalServerDiskOptions model - updateBareMetalServerDiskOptionsModel := new(vpcv1.UpdateBareMetalServerDiskOptions) - updateBareMetalServerDiskOptionsModel.BareMetalServerID = core.StringPtr("testString") - updateBareMetalServerDiskOptionsModel.ID = core.StringPtr("testString") - updateBareMetalServerDiskOptionsModel.BareMetalServerDiskPatch = bareMetalServerDiskPatchModelAsPatch - updateBareMetalServerDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the KeyIdentityByID model + keyIdentityModel := new(vpcv1.KeyIdentityByID) + keyIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") + + // Construct an instance of the BareMetalServerInitializationPrototype model + bareMetalServerInitializationPrototypeModel := new(vpcv1.BareMetalServerInitializationPrototype) + bareMetalServerInitializationPrototypeModel.Image = imageIdentityModel + bareMetalServerInitializationPrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} + bareMetalServerInitializationPrototypeModel.UserData = core.StringPtr("testString") + + // Construct an instance of the BareMetalServerProfileIdentityByName model + bareMetalServerProfileIdentityModel := new(vpcv1.BareMetalServerProfileIdentityByName) + bareMetalServerProfileIdentityModel.Name = core.StringPtr("bx2-metal-192x768") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the BareMetalServerTrustedPlatformModulePrototype model + bareMetalServerTrustedPlatformModulePrototypeModel := new(vpcv1.BareMetalServerTrustedPlatformModulePrototype) + bareMetalServerTrustedPlatformModulePrototypeModel.Mode = core.StringPtr("disabled") + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // 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 SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext model + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + + // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype model + bareMetalServerNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) + bareMetalServerNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") + bareMetalServerNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + bareMetalServerNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} + bareMetalServerNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") + + // Construct an instance of the BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype model + bareMetalServerPrimaryNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype) + bareMetalServerPrimaryNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") + bareMetalServerPrimaryNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + bareMetalServerPrimaryNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} + bareMetalServerPrimaryNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") + + // Construct an instance of the BareMetalServerPrototypeBareMetalServerByNetworkAttachment model + bareMetalServerPrototypeModel := new(vpcv1.BareMetalServerPrototypeBareMetalServerByNetworkAttachment) + bareMetalServerPrototypeModel.EnableSecureBoot = core.BoolPtr(false) + bareMetalServerPrototypeModel.Initialization = bareMetalServerInitializationPrototypeModel + bareMetalServerPrototypeModel.Name = core.StringPtr("my-bare-metal-server") + bareMetalServerPrototypeModel.Profile = bareMetalServerProfileIdentityModel + bareMetalServerPrototypeModel.ResourceGroup = resourceGroupIdentityModel + bareMetalServerPrototypeModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePrototypeModel + bareMetalServerPrototypeModel.VPC = vpcIdentityModel + bareMetalServerPrototypeModel.Zone = zoneIdentityModel + bareMetalServerPrototypeModel.NetworkAttachments = []vpcv1.BareMetalServerNetworkAttachmentPrototypeIntf{bareMetalServerNetworkAttachmentPrototypeModel} + bareMetalServerPrototypeModel.PrimaryNetworkAttachment = bareMetalServerPrimaryNetworkAttachmentPrototypeModel + + // Construct an instance of the CreateBareMetalServerOptions model + createBareMetalServerOptionsModel := new(vpcv1.CreateBareMetalServerOptions) + createBareMetalServerOptionsModel.BareMetalServerPrototype = bareMetalServerPrototypeModel + createBareMetalServerOptionsModel.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.UpdateBareMetalServerDisk(updateBareMetalServerDiskOptionsModel) + result, response, operationErr := vpcService.CreateBareMetalServer(createBareMetalServerOptionsModel) 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.UpdateBareMetalServerDisk(updateBareMetalServerDiskOptionsModel) + result, response, operationErr = vpcService.CreateBareMetalServer(createBareMetalServerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -44966,17 +45341,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateBareMetalServerDisk(updateBareMetalServerDiskOptions *UpdateBareMetalServerDiskOptions)`, func() { + Describe(`CreateBareMetalServer(createBareMetalServerOptions *CreateBareMetalServerOptions)`, func() { version := "testString" - updateBareMetalServerDiskPath := "/bare_metal_servers/testString/disks/testString" + createBareMetalServerPath := "/bare_metal_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(updateBareMetalServerDiskPath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(createBareMetalServerPath)) + Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -45001,11 +45376,11 @@ 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/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "name": "my-bare-metal-server", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"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"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"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"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}], "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"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"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"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"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "deleting", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "disabled", "supported_modes": ["disabled"]}, "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"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke UpdateBareMetalServerDisk successfully with retries`, func() { + It(`Invoke CreateBareMetalServer successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -45015,29 +45390,114 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the BareMetalServerDiskPatch model - bareMetalServerDiskPatchModel := new(vpcv1.BareMetalServerDiskPatch) - bareMetalServerDiskPatchModel.Name = core.StringPtr("my-bare-metal-server-disk-updated") - bareMetalServerDiskPatchModelAsPatch, asPatchErr := bareMetalServerDiskPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the ImageIdentityByID model + imageIdentityModel := new(vpcv1.ImageIdentityByID) + imageIdentityModel.ID = core.StringPtr("72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") - // Construct an instance of the UpdateBareMetalServerDiskOptions model - updateBareMetalServerDiskOptionsModel := new(vpcv1.UpdateBareMetalServerDiskOptions) - updateBareMetalServerDiskOptionsModel.BareMetalServerID = core.StringPtr("testString") - updateBareMetalServerDiskOptionsModel.ID = core.StringPtr("testString") - updateBareMetalServerDiskOptionsModel.BareMetalServerDiskPatch = bareMetalServerDiskPatchModelAsPatch - updateBareMetalServerDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the KeyIdentityByID model + keyIdentityModel := new(vpcv1.KeyIdentityByID) + keyIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") + + // Construct an instance of the BareMetalServerInitializationPrototype model + bareMetalServerInitializationPrototypeModel := new(vpcv1.BareMetalServerInitializationPrototype) + bareMetalServerInitializationPrototypeModel.Image = imageIdentityModel + bareMetalServerInitializationPrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} + bareMetalServerInitializationPrototypeModel.UserData = core.StringPtr("testString") + + // Construct an instance of the BareMetalServerProfileIdentityByName model + bareMetalServerProfileIdentityModel := new(vpcv1.BareMetalServerProfileIdentityByName) + bareMetalServerProfileIdentityModel.Name = core.StringPtr("bx2-metal-192x768") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the BareMetalServerTrustedPlatformModulePrototype model + bareMetalServerTrustedPlatformModulePrototypeModel := new(vpcv1.BareMetalServerTrustedPlatformModulePrototype) + bareMetalServerTrustedPlatformModulePrototypeModel.Mode = core.StringPtr("disabled") + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // 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 SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext model + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + + // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype model + bareMetalServerNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) + bareMetalServerNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") + bareMetalServerNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + bareMetalServerNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} + bareMetalServerNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") + + // Construct an instance of the BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype model + bareMetalServerPrimaryNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype) + bareMetalServerPrimaryNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") + bareMetalServerPrimaryNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + bareMetalServerPrimaryNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} + bareMetalServerPrimaryNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") + + // Construct an instance of the BareMetalServerPrototypeBareMetalServerByNetworkAttachment model + bareMetalServerPrototypeModel := new(vpcv1.BareMetalServerPrototypeBareMetalServerByNetworkAttachment) + bareMetalServerPrototypeModel.EnableSecureBoot = core.BoolPtr(false) + bareMetalServerPrototypeModel.Initialization = bareMetalServerInitializationPrototypeModel + bareMetalServerPrototypeModel.Name = core.StringPtr("my-bare-metal-server") + bareMetalServerPrototypeModel.Profile = bareMetalServerProfileIdentityModel + bareMetalServerPrototypeModel.ResourceGroup = resourceGroupIdentityModel + bareMetalServerPrototypeModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePrototypeModel + bareMetalServerPrototypeModel.VPC = vpcIdentityModel + bareMetalServerPrototypeModel.Zone = zoneIdentityModel + bareMetalServerPrototypeModel.NetworkAttachments = []vpcv1.BareMetalServerNetworkAttachmentPrototypeIntf{bareMetalServerNetworkAttachmentPrototypeModel} + bareMetalServerPrototypeModel.PrimaryNetworkAttachment = bareMetalServerPrimaryNetworkAttachmentPrototypeModel + + // Construct an instance of the CreateBareMetalServerOptions model + createBareMetalServerOptionsModel := new(vpcv1.CreateBareMetalServerOptions) + createBareMetalServerOptionsModel.BareMetalServerPrototype = bareMetalServerPrototypeModel + createBareMetalServerOptionsModel.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.UpdateBareMetalServerDiskWithContext(ctx, updateBareMetalServerDiskOptionsModel) + _, _, operationErr := vpcService.CreateBareMetalServerWithContext(ctx, createBareMetalServerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateBareMetalServerDisk(updateBareMetalServerDiskOptionsModel) + result, response, operationErr := vpcService.CreateBareMetalServer(createBareMetalServerOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -45045,7 +45505,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateBareMetalServerDiskWithContext(ctx, updateBareMetalServerDiskOptionsModel) + _, _, operationErr = vpcService.CreateBareMetalServerWithContext(ctx, createBareMetalServerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -45059,8 +45519,8 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateBareMetalServerDiskPath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(createBareMetalServerPath)) + Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -45082,11 +45542,11 @@ var _ = Describe(`VpcV1`, func() { 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/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "name": "my-bare-metal-server", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"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"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"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"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}], "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"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"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"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"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "deleting", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "disabled", "supported_modes": ["disabled"]}, "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"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke UpdateBareMetalServerDisk successfully`, func() { + It(`Invoke CreateBareMetalServer successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -45096,32 +45556,117 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateBareMetalServerDisk(nil) + result, response, operationErr := vpcService.CreateBareMetalServer(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the BareMetalServerDiskPatch model - bareMetalServerDiskPatchModel := new(vpcv1.BareMetalServerDiskPatch) - bareMetalServerDiskPatchModel.Name = core.StringPtr("my-bare-metal-server-disk-updated") - bareMetalServerDiskPatchModelAsPatch, asPatchErr := bareMetalServerDiskPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the ImageIdentityByID model + imageIdentityModel := new(vpcv1.ImageIdentityByID) + imageIdentityModel.ID = core.StringPtr("72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") - // Construct an instance of the UpdateBareMetalServerDiskOptions model - updateBareMetalServerDiskOptionsModel := new(vpcv1.UpdateBareMetalServerDiskOptions) - updateBareMetalServerDiskOptionsModel.BareMetalServerID = core.StringPtr("testString") - updateBareMetalServerDiskOptionsModel.ID = core.StringPtr("testString") - updateBareMetalServerDiskOptionsModel.BareMetalServerDiskPatch = bareMetalServerDiskPatchModelAsPatch - updateBareMetalServerDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the KeyIdentityByID model + keyIdentityModel := new(vpcv1.KeyIdentityByID) + keyIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") + + // Construct an instance of the BareMetalServerInitializationPrototype model + bareMetalServerInitializationPrototypeModel := new(vpcv1.BareMetalServerInitializationPrototype) + bareMetalServerInitializationPrototypeModel.Image = imageIdentityModel + bareMetalServerInitializationPrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} + bareMetalServerInitializationPrototypeModel.UserData = core.StringPtr("testString") + + // Construct an instance of the BareMetalServerProfileIdentityByName model + bareMetalServerProfileIdentityModel := new(vpcv1.BareMetalServerProfileIdentityByName) + bareMetalServerProfileIdentityModel.Name = core.StringPtr("bx2-metal-192x768") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the BareMetalServerTrustedPlatformModulePrototype model + bareMetalServerTrustedPlatformModulePrototypeModel := new(vpcv1.BareMetalServerTrustedPlatformModulePrototype) + bareMetalServerTrustedPlatformModulePrototypeModel.Mode = core.StringPtr("disabled") + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // 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 SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext model + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + + // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype model + bareMetalServerNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) + bareMetalServerNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") + bareMetalServerNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + bareMetalServerNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} + bareMetalServerNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") + + // Construct an instance of the BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype model + bareMetalServerPrimaryNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype) + bareMetalServerPrimaryNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") + bareMetalServerPrimaryNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + bareMetalServerPrimaryNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} + bareMetalServerPrimaryNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") + + // Construct an instance of the BareMetalServerPrototypeBareMetalServerByNetworkAttachment model + bareMetalServerPrototypeModel := new(vpcv1.BareMetalServerPrototypeBareMetalServerByNetworkAttachment) + bareMetalServerPrototypeModel.EnableSecureBoot = core.BoolPtr(false) + bareMetalServerPrototypeModel.Initialization = bareMetalServerInitializationPrototypeModel + bareMetalServerPrototypeModel.Name = core.StringPtr("my-bare-metal-server") + bareMetalServerPrototypeModel.Profile = bareMetalServerProfileIdentityModel + bareMetalServerPrototypeModel.ResourceGroup = resourceGroupIdentityModel + bareMetalServerPrototypeModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePrototypeModel + bareMetalServerPrototypeModel.VPC = vpcIdentityModel + bareMetalServerPrototypeModel.Zone = zoneIdentityModel + bareMetalServerPrototypeModel.NetworkAttachments = []vpcv1.BareMetalServerNetworkAttachmentPrototypeIntf{bareMetalServerNetworkAttachmentPrototypeModel} + bareMetalServerPrototypeModel.PrimaryNetworkAttachment = bareMetalServerPrimaryNetworkAttachmentPrototypeModel + + // Construct an instance of the CreateBareMetalServerOptions model + createBareMetalServerOptionsModel := new(vpcv1.CreateBareMetalServerOptions) + createBareMetalServerOptionsModel.BareMetalServerPrototype = bareMetalServerPrototypeModel + createBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateBareMetalServerDisk(updateBareMetalServerDiskOptionsModel) + result, response, operationErr = vpcService.CreateBareMetalServer(createBareMetalServerOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateBareMetalServerDisk with error: Operation validation and request error`, func() { + It(`Invoke CreateBareMetalServer with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -45130,36 +45675,121 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the BareMetalServerDiskPatch model - bareMetalServerDiskPatchModel := new(vpcv1.BareMetalServerDiskPatch) - bareMetalServerDiskPatchModel.Name = core.StringPtr("my-bare-metal-server-disk-updated") - bareMetalServerDiskPatchModelAsPatch, asPatchErr := bareMetalServerDiskPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the ImageIdentityByID model + imageIdentityModel := new(vpcv1.ImageIdentityByID) + imageIdentityModel.ID = core.StringPtr("72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") - // Construct an instance of the UpdateBareMetalServerDiskOptions model - updateBareMetalServerDiskOptionsModel := new(vpcv1.UpdateBareMetalServerDiskOptions) - updateBareMetalServerDiskOptionsModel.BareMetalServerID = core.StringPtr("testString") - updateBareMetalServerDiskOptionsModel.ID = core.StringPtr("testString") - updateBareMetalServerDiskOptionsModel.BareMetalServerDiskPatch = bareMetalServerDiskPatchModelAsPatch - updateBareMetalServerDiskOptionsModel.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.UpdateBareMetalServerDisk(updateBareMetalServerDiskOptionsModel) - 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 UpdateBareMetalServerDiskOptions model with no property values - updateBareMetalServerDiskOptionsModelNew := new(vpcv1.UpdateBareMetalServerDiskOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateBareMetalServerDisk(updateBareMetalServerDiskOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() + // Construct an instance of the KeyIdentityByID model + keyIdentityModel := new(vpcv1.KeyIdentityByID) + keyIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") + + // Construct an instance of the BareMetalServerInitializationPrototype model + bareMetalServerInitializationPrototypeModel := new(vpcv1.BareMetalServerInitializationPrototype) + bareMetalServerInitializationPrototypeModel.Image = imageIdentityModel + bareMetalServerInitializationPrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} + bareMetalServerInitializationPrototypeModel.UserData = core.StringPtr("testString") + + // Construct an instance of the BareMetalServerProfileIdentityByName model + bareMetalServerProfileIdentityModel := new(vpcv1.BareMetalServerProfileIdentityByName) + bareMetalServerProfileIdentityModel.Name = core.StringPtr("bx2-metal-192x768") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the BareMetalServerTrustedPlatformModulePrototype model + bareMetalServerTrustedPlatformModulePrototypeModel := new(vpcv1.BareMetalServerTrustedPlatformModulePrototype) + bareMetalServerTrustedPlatformModulePrototypeModel.Mode = core.StringPtr("disabled") + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // 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 SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext model + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + + // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype model + bareMetalServerNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) + bareMetalServerNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") + bareMetalServerNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + bareMetalServerNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} + bareMetalServerNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") + + // Construct an instance of the BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype model + bareMetalServerPrimaryNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype) + bareMetalServerPrimaryNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") + bareMetalServerPrimaryNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + bareMetalServerPrimaryNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} + bareMetalServerPrimaryNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") + + // Construct an instance of the BareMetalServerPrototypeBareMetalServerByNetworkAttachment model + bareMetalServerPrototypeModel := new(vpcv1.BareMetalServerPrototypeBareMetalServerByNetworkAttachment) + bareMetalServerPrototypeModel.EnableSecureBoot = core.BoolPtr(false) + bareMetalServerPrototypeModel.Initialization = bareMetalServerInitializationPrototypeModel + bareMetalServerPrototypeModel.Name = core.StringPtr("my-bare-metal-server") + bareMetalServerPrototypeModel.Profile = bareMetalServerProfileIdentityModel + bareMetalServerPrototypeModel.ResourceGroup = resourceGroupIdentityModel + bareMetalServerPrototypeModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePrototypeModel + bareMetalServerPrototypeModel.VPC = vpcIdentityModel + bareMetalServerPrototypeModel.Zone = zoneIdentityModel + bareMetalServerPrototypeModel.NetworkAttachments = []vpcv1.BareMetalServerNetworkAttachmentPrototypeIntf{bareMetalServerNetworkAttachmentPrototypeModel} + bareMetalServerPrototypeModel.PrimaryNetworkAttachment = bareMetalServerPrimaryNetworkAttachmentPrototypeModel + + // Construct an instance of the CreateBareMetalServerOptions model + createBareMetalServerOptionsModel := new(vpcv1.CreateBareMetalServerOptions) + createBareMetalServerOptionsModel.BareMetalServerPrototype = bareMetalServerPrototypeModel + createBareMetalServerOptionsModel.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.CreateBareMetalServer(createBareMetalServerOptionsModel) + 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 CreateBareMetalServerOptions model with no property values + createBareMetalServerOptionsModelNew := new(vpcv1.CreateBareMetalServerOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateBareMetalServer(createBareMetalServerOptionsModelNew) + 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() { @@ -45168,10 +45798,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke UpdateBareMetalServerDisk successfully`, func() { + It(`Invoke CreateBareMetalServer successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -45180,21 +45810,106 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the BareMetalServerDiskPatch model - bareMetalServerDiskPatchModel := new(vpcv1.BareMetalServerDiskPatch) - bareMetalServerDiskPatchModel.Name = core.StringPtr("my-bare-metal-server-disk-updated") - bareMetalServerDiskPatchModelAsPatch, asPatchErr := bareMetalServerDiskPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the ImageIdentityByID model + imageIdentityModel := new(vpcv1.ImageIdentityByID) + imageIdentityModel.ID = core.StringPtr("72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") - // Construct an instance of the UpdateBareMetalServerDiskOptions model - updateBareMetalServerDiskOptionsModel := new(vpcv1.UpdateBareMetalServerDiskOptions) - updateBareMetalServerDiskOptionsModel.BareMetalServerID = core.StringPtr("testString") - updateBareMetalServerDiskOptionsModel.ID = core.StringPtr("testString") - updateBareMetalServerDiskOptionsModel.BareMetalServerDiskPatch = bareMetalServerDiskPatchModelAsPatch - updateBareMetalServerDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the KeyIdentityByID model + keyIdentityModel := new(vpcv1.KeyIdentityByID) + keyIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") + + // Construct an instance of the BareMetalServerInitializationPrototype model + bareMetalServerInitializationPrototypeModel := new(vpcv1.BareMetalServerInitializationPrototype) + bareMetalServerInitializationPrototypeModel.Image = imageIdentityModel + bareMetalServerInitializationPrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} + bareMetalServerInitializationPrototypeModel.UserData = core.StringPtr("testString") + + // Construct an instance of the BareMetalServerProfileIdentityByName model + bareMetalServerProfileIdentityModel := new(vpcv1.BareMetalServerProfileIdentityByName) + bareMetalServerProfileIdentityModel.Name = core.StringPtr("bx2-metal-192x768") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the BareMetalServerTrustedPlatformModulePrototype model + bareMetalServerTrustedPlatformModulePrototypeModel := new(vpcv1.BareMetalServerTrustedPlatformModulePrototype) + bareMetalServerTrustedPlatformModulePrototypeModel.Mode = core.StringPtr("disabled") + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // 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 SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext model + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + + // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype model + bareMetalServerNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) + bareMetalServerNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") + bareMetalServerNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + bareMetalServerNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} + bareMetalServerNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") + + // Construct an instance of the BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype model + bareMetalServerPrimaryNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype) + bareMetalServerPrimaryNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") + bareMetalServerPrimaryNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + bareMetalServerPrimaryNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} + bareMetalServerPrimaryNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") + + // Construct an instance of the BareMetalServerPrototypeBareMetalServerByNetworkAttachment model + bareMetalServerPrototypeModel := new(vpcv1.BareMetalServerPrototypeBareMetalServerByNetworkAttachment) + bareMetalServerPrototypeModel.EnableSecureBoot = core.BoolPtr(false) + bareMetalServerPrototypeModel.Initialization = bareMetalServerInitializationPrototypeModel + bareMetalServerPrototypeModel.Name = core.StringPtr("my-bare-metal-server") + bareMetalServerPrototypeModel.Profile = bareMetalServerProfileIdentityModel + bareMetalServerPrototypeModel.ResourceGroup = resourceGroupIdentityModel + bareMetalServerPrototypeModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePrototypeModel + bareMetalServerPrototypeModel.VPC = vpcIdentityModel + bareMetalServerPrototypeModel.Zone = zoneIdentityModel + bareMetalServerPrototypeModel.NetworkAttachments = []vpcv1.BareMetalServerNetworkAttachmentPrototypeIntf{bareMetalServerNetworkAttachmentPrototypeModel} + bareMetalServerPrototypeModel.PrimaryNetworkAttachment = bareMetalServerPrimaryNetworkAttachmentPrototypeModel + + // Construct an instance of the CreateBareMetalServerOptions model + createBareMetalServerOptionsModel := new(vpcv1.CreateBareMetalServerOptions) + createBareMetalServerOptionsModel.BareMetalServerPrototype = bareMetalServerPrototypeModel + createBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.UpdateBareMetalServerDisk(updateBareMetalServerDiskOptionsModel) + result, response, operationErr := vpcService.CreateBareMetalServer(createBareMetalServerOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -45206,27 +45921,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) - Operation response error`, func() { + Describe(`CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptions *CreateBareMetalServerConsoleAccessTokenOptions) - Operation response error`, func() { version := "testString" - listBareMetalServerNetworkInterfacesPath := "/bare_metal_servers/testString/network_interfaces" + createBareMetalServerConsoleAccessTokenPath := "/bare_metal_servers/testString/console_access_token" 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(listBareMetalServerNetworkInterfacesPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createBareMetalServerConsoleAccessTokenPath)) + 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))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListBareMetalServerNetworkInterfaces with error: Operation response processing error`, func() { + It(`Invoke CreateBareMetalServerConsoleAccessToken with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -45235,21 +45948,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBareMetalServerNetworkInterfacesOptions model - listBareMetalServerNetworkInterfacesOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfacesOptions) - listBareMetalServerNetworkInterfacesOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") - listBareMetalServerNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBareMetalServerNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateBareMetalServerConsoleAccessTokenOptions model + createBareMetalServerConsoleAccessTokenOptionsModel := new(vpcv1.CreateBareMetalServerConsoleAccessTokenOptions) + createBareMetalServerConsoleAccessTokenOptionsModel.BareMetalServerID = core.StringPtr("testString") + createBareMetalServerConsoleAccessTokenOptionsModel.ConsoleType = core.StringPtr("serial") + createBareMetalServerConsoleAccessTokenOptionsModel.Force = core.BoolPtr(false) + createBareMetalServerConsoleAccessTokenOptionsModel.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.ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptionsModel) + result, response, operationErr := vpcService.CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptionsModel) 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.ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptionsModel) + result, response, operationErr = vpcService.CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -45259,32 +45972,46 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions)`, func() { + Describe(`CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptions *CreateBareMetalServerConsoleAccessTokenOptions)`, func() { version := "testString" - listBareMetalServerNetworkInterfacesPath := "/bare_metal_servers/testString/network_interfaces" + createBareMetalServerConsoleAccessTokenPath := "/bare_metal_servers/testString/console_access_token" 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(listBareMetalServerNetworkInterfacesPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createBareMetalServerConsoleAccessTokenPath)) + 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))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) // 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/bare_metal_servers/3b2669a2-4c2b-4003-bc91-1b81f1326267/network_interfaces?limit=20"}, "limit": 20, "network_interfaces": [{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-network-interface", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "network_interface", "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"}], "status": "available", "subnet": {"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"}, "type": "primary", "interface_type": "hipersocket"}], "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/3b2669a2-4c2b-4003-bc91-1b81f1326267/network_interfaces?start=d3e721fd-c988-4670-9927-dbd5e7b07fc6&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"access_token": "VGhpcyBJcyBhIHRva2Vu", "console_type": "serial", "created_at": "2020-07-27T21:50:14.000Z", "expires_at": "2020-07-27T21:51:14.000Z", "force": false, "href": "wss://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/console?access_token=VGhpcyBJcyBhIHRva2Vu"}`) })) }) - It(`Invoke ListBareMetalServerNetworkInterfaces successfully with retries`, func() { + It(`Invoke CreateBareMetalServerConsoleAccessToken successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -45294,23 +46021,23 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListBareMetalServerNetworkInterfacesOptions model - listBareMetalServerNetworkInterfacesOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfacesOptions) - listBareMetalServerNetworkInterfacesOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") - listBareMetalServerNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBareMetalServerNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateBareMetalServerConsoleAccessTokenOptions model + createBareMetalServerConsoleAccessTokenOptionsModel := new(vpcv1.CreateBareMetalServerConsoleAccessTokenOptions) + createBareMetalServerConsoleAccessTokenOptionsModel.BareMetalServerID = core.StringPtr("testString") + createBareMetalServerConsoleAccessTokenOptionsModel.ConsoleType = core.StringPtr("serial") + createBareMetalServerConsoleAccessTokenOptionsModel.Force = core.BoolPtr(false) + createBareMetalServerConsoleAccessTokenOptionsModel.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.ListBareMetalServerNetworkInterfacesWithContext(ctx, listBareMetalServerNetworkInterfacesOptionsModel) + _, _, operationErr := vpcService.CreateBareMetalServerConsoleAccessTokenWithContext(ctx, createBareMetalServerConsoleAccessTokenOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptionsModel) + result, response, operationErr := vpcService.CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -45318,7 +46045,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListBareMetalServerNetworkInterfacesWithContext(ctx, listBareMetalServerNetworkInterfacesOptionsModel) + _, _, operationErr = vpcService.CreateBareMetalServerConsoleAccessTokenWithContext(ctx, createBareMetalServerConsoleAccessTokenOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -45332,20 +46059,34 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerNetworkInterfacesPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createBareMetalServerConsoleAccessTokenPath)) + 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))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) // 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/bare_metal_servers/3b2669a2-4c2b-4003-bc91-1b81f1326267/network_interfaces?limit=20"}, "limit": 20, "network_interfaces": [{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-network-interface", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "network_interface", "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"}], "status": "available", "subnet": {"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"}, "type": "primary", "interface_type": "hipersocket"}], "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/3b2669a2-4c2b-4003-bc91-1b81f1326267/network_interfaces?start=d3e721fd-c988-4670-9927-dbd5e7b07fc6&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"access_token": "VGhpcyBJcyBhIHRva2Vu", "console_type": "serial", "created_at": "2020-07-27T21:50:14.000Z", "expires_at": "2020-07-27T21:51:14.000Z", "force": false, "href": "wss://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/console?access_token=VGhpcyBJcyBhIHRva2Vu"}`) })) }) - It(`Invoke ListBareMetalServerNetworkInterfaces successfully`, func() { + It(`Invoke CreateBareMetalServerConsoleAccessToken successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -45355,26 +46096,26 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaces(nil) + result, response, operationErr := vpcService.CreateBareMetalServerConsoleAccessToken(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListBareMetalServerNetworkInterfacesOptions model - listBareMetalServerNetworkInterfacesOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfacesOptions) - listBareMetalServerNetworkInterfacesOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") - listBareMetalServerNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBareMetalServerNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateBareMetalServerConsoleAccessTokenOptions model + createBareMetalServerConsoleAccessTokenOptionsModel := new(vpcv1.CreateBareMetalServerConsoleAccessTokenOptions) + createBareMetalServerConsoleAccessTokenOptionsModel.BareMetalServerID = core.StringPtr("testString") + createBareMetalServerConsoleAccessTokenOptionsModel.ConsoleType = core.StringPtr("serial") + createBareMetalServerConsoleAccessTokenOptionsModel.Force = core.BoolPtr(false) + createBareMetalServerConsoleAccessTokenOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptionsModel) + result, response, operationErr = vpcService.CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListBareMetalServerNetworkInterfaces with error: Operation validation and request error`, func() { + It(`Invoke CreateBareMetalServerConsoleAccessToken with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -45383,24 +46124,24 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBareMetalServerNetworkInterfacesOptions model - listBareMetalServerNetworkInterfacesOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfacesOptions) - listBareMetalServerNetworkInterfacesOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") - listBareMetalServerNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBareMetalServerNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateBareMetalServerConsoleAccessTokenOptions model + createBareMetalServerConsoleAccessTokenOptionsModel := new(vpcv1.CreateBareMetalServerConsoleAccessTokenOptions) + createBareMetalServerConsoleAccessTokenOptionsModel.BareMetalServerID = core.StringPtr("testString") + createBareMetalServerConsoleAccessTokenOptionsModel.ConsoleType = core.StringPtr("serial") + createBareMetalServerConsoleAccessTokenOptionsModel.Force = core.BoolPtr(false) + createBareMetalServerConsoleAccessTokenOptionsModel.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.ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptionsModel) + result, response, operationErr := vpcService.CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptionsModel) 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 ListBareMetalServerNetworkInterfacesOptions model with no property values - listBareMetalServerNetworkInterfacesOptionsModelNew := new(vpcv1.ListBareMetalServerNetworkInterfacesOptions) + // Construct a second instance of the CreateBareMetalServerConsoleAccessTokenOptions model with no property values + createBareMetalServerConsoleAccessTokenOptionsModelNew := new(vpcv1.CreateBareMetalServerConsoleAccessTokenOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptionsModelNew) + result, response, operationErr = vpcService.CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -45418,7 +46159,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListBareMetalServerNetworkInterfaces successfully`, func() { + It(`Invoke CreateBareMetalServerConsoleAccessToken successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -45427,15 +46168,15 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBareMetalServerNetworkInterfacesOptions model - listBareMetalServerNetworkInterfacesOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfacesOptions) - listBareMetalServerNetworkInterfacesOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") - listBareMetalServerNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listBareMetalServerNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateBareMetalServerConsoleAccessTokenOptions model + createBareMetalServerConsoleAccessTokenOptionsModel := new(vpcv1.CreateBareMetalServerConsoleAccessTokenOptions) + createBareMetalServerConsoleAccessTokenOptionsModel.BareMetalServerID = core.StringPtr("testString") + createBareMetalServerConsoleAccessTokenOptionsModel.ConsoleType = core.StringPtr("serial") + createBareMetalServerConsoleAccessTokenOptionsModel.Force = core.BoolPtr(false) + createBareMetalServerConsoleAccessTokenOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptionsModel) + result, response, operationErr := vpcService.CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -45446,129 +46187,26 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) - Context(`Test pagination helper method on response`, func() { - It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.BareMetalServerNetworkInterfaceCollection) - nextObject := new(vpcv1.BareMetalServerNetworkInterfaceCollectionNext) - 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.BareMetalServerNetworkInterfaceCollection) - - 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.BareMetalServerNetworkInterfaceCollection) - nextObject := new(vpcv1.BareMetalServerNetworkInterfaceCollectionNext) - nextObject.Href = core.StringPtr("ibm.com") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - }) - Context(`Using mock server endpoint - paginated response`, func() { - BeforeEach(func() { - var requestNumber int = 0 - 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(listBareMetalServerNetworkInterfacesPath)) - Expect(req.Method).To(Equal("GET")) - - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - requestNumber++ - if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"network_interfaces":[{"allow_ip_spoofing":true,"created_at":"2019-01-01T12:00:00.000Z","enable_infrastructure_nat":true,"floating_ips":[{"address":"203.0.113.1","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689","id":"39300233-9995-4806-89a5-3c1b6eb88689","name":"my-floating-ip"}],"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","mac_address":"02:00:04:00:C4:6A","name":"my-bare-metal-server-network-interface","port_speed":1000,"primary_ip":{"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"},"resource_type":"network_interface","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"}],"status":"available","subnet":{"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"},"type":"primary","interface_type":"hipersocket"}]}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"network_interfaces":[{"allow_ip_spoofing":true,"created_at":"2019-01-01T12:00:00.000Z","enable_infrastructure_nat":true,"floating_ips":[{"address":"203.0.113.1","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689","id":"39300233-9995-4806-89a5-3c1b6eb88689","name":"my-floating-ip"}],"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","mac_address":"02:00:04:00:C4:6A","name":"my-bare-metal-server-network-interface","port_speed":1000,"primary_ip":{"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"},"resource_type":"network_interface","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"}],"status":"available","subnet":{"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"},"type":"primary","interface_type":"hipersocket"}]}`) - } else { - res.WriteHeader(400) - } - })) - }) - It(`Use BareMetalServerNetworkInterfacesPager.GetNext 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()) - - listBareMetalServerNetworkInterfacesOptionsModel := &vpcv1.ListBareMetalServerNetworkInterfacesOptions{ - BareMetalServerID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewBareMetalServerNetworkInterfacesPager(listBareMetalServerNetworkInterfacesOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.BareMetalServerNetworkInterfaceIntf - for pager.HasNext() { - nextPage, err := pager.GetNext() - Expect(err).To(BeNil()) - Expect(nextPage).ToNot(BeNil()) - allResults = append(allResults, nextPage...) - } - Expect(len(allResults)).To(Equal(2)) - }) - It(`Use BareMetalServerNetworkInterfacesPager.GetAll 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()) - - listBareMetalServerNetworkInterfacesOptionsModel := &vpcv1.ListBareMetalServerNetworkInterfacesOptions{ - BareMetalServerID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewBareMetalServerNetworkInterfacesPager(listBareMetalServerNetworkInterfacesOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - allResults, err := pager.GetAll() - Expect(err).To(BeNil()) - Expect(allResults).ToNot(BeNil()) - Expect(len(allResults)).To(Equal(2)) - }) - }) }) - Describe(`CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions) - Operation response error`, func() { + Describe(`ListBareMetalServerDisks(listBareMetalServerDisksOptions *ListBareMetalServerDisksOptions) - Operation response error`, func() { version := "testString" - createBareMetalServerNetworkInterfacePath := "/bare_metal_servers/testString/network_interfaces" + listBareMetalServerDisksPath := "/bare_metal_servers/testString/disks" 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(createBareMetalServerNetworkInterfacePath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerDisksPath)) + 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(201) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateBareMetalServerNetworkInterface with error: Operation response processing error`, func() { + It(`Invoke ListBareMetalServerDisks with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -45577,44 +46215,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model - networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) - networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // 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 SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype model - bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) - bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerNetworkInterfacePrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-interface") - bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") - - // Construct an instance of the CreateBareMetalServerNetworkInterfaceOptions model - createBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.CreateBareMetalServerNetworkInterfaceOptions) - createBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") - createBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePrototype = bareMetalServerNetworkInterfacePrototypeModel - createBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBareMetalServerDisksOptions model + listBareMetalServerDisksOptionsModel := new(vpcv1.ListBareMetalServerDisksOptions) + listBareMetalServerDisksOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerDisksOptionsModel.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.CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.ListBareMetalServerDisks(listBareMetalServerDisksOptionsModel) 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.CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptionsModel) + result, response, operationErr = vpcService.ListBareMetalServerDisks(listBareMetalServerDisksOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -45624,33 +46237,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions)`, func() { + Describe(`ListBareMetalServerDisks(listBareMetalServerDisksOptions *ListBareMetalServerDisksOptions)`, func() { version := "testString" - createBareMetalServerNetworkInterfacePath := "/bare_metal_servers/testString/network_interfaces" + listBareMetalServerDisksPath := "/bare_metal_servers/testString/disks" 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(createBareMetalServerNetworkInterfacePath)) - 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.EscapedPath()).To(Equal(listBareMetalServerDisksPath)) + 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))})) @@ -45659,11 +46256,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-network-interface", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "network_interface", "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"}], "status": "available", "subnet": {"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"}, "type": "primary", "interface_type": "hipersocket"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}]}`) })) }) - It(`Invoke CreateBareMetalServerNetworkInterface successfully with retries`, func() { + It(`Invoke ListBareMetalServerDisks successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -45673,46 +46270,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model - networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) - networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // 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 SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype model - bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) - bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerNetworkInterfacePrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-interface") - bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") - - // Construct an instance of the CreateBareMetalServerNetworkInterfaceOptions model - createBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.CreateBareMetalServerNetworkInterfaceOptions) - createBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") - createBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePrototype = bareMetalServerNetworkInterfacePrototypeModel - createBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBareMetalServerDisksOptions model + listBareMetalServerDisksOptionsModel := new(vpcv1.ListBareMetalServerDisksOptions) + listBareMetalServerDisksOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerDisksOptionsModel.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.CreateBareMetalServerNetworkInterfaceWithContext(ctx, createBareMetalServerNetworkInterfaceOptionsModel) + _, _, operationErr := vpcService.ListBareMetalServerDisksWithContext(ctx, listBareMetalServerDisksOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.ListBareMetalServerDisks(listBareMetalServerDisksOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -45720,7 +46292,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreateBareMetalServerNetworkInterfaceWithContext(ctx, createBareMetalServerNetworkInterfaceOptionsModel) + _, _, operationErr = vpcService.ListBareMetalServerDisksWithContext(ctx, listBareMetalServerDisksOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -45734,34 +46306,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createBareMetalServerNetworkInterfacePath)) - 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.EscapedPath()).To(Equal(listBareMetalServerDisksPath)) + 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(201) - fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-network-interface", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "network_interface", "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"}], "status": "available", "subnet": {"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"}, "type": "primary", "interface_type": "hipersocket"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}]}`) })) }) - It(`Invoke CreateBareMetalServerNetworkInterface successfully`, func() { + It(`Invoke ListBareMetalServerDisks successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -45771,49 +46327,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreateBareMetalServerNetworkInterface(nil) + result, response, operationErr := vpcService.ListBareMetalServerDisks(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model - networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) - networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // 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 SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype model - bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) - bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerNetworkInterfacePrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-interface") - bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") - - // Construct an instance of the CreateBareMetalServerNetworkInterfaceOptions model - createBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.CreateBareMetalServerNetworkInterfaceOptions) - createBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") - createBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePrototype = bareMetalServerNetworkInterfacePrototypeModel - createBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBareMetalServerDisksOptions model + listBareMetalServerDisksOptionsModel := new(vpcv1.ListBareMetalServerDisksOptions) + listBareMetalServerDisksOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerDisksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptionsModel) + result, response, operationErr = vpcService.ListBareMetalServerDisks(listBareMetalServerDisksOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateBareMetalServerNetworkInterface with error: Operation validation and request error`, func() { + It(`Invoke ListBareMetalServerDisks with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -45822,47 +46353,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model - networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) - networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // 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 SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype model - bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) - bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerNetworkInterfacePrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-interface") - bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") - - // Construct an instance of the CreateBareMetalServerNetworkInterfaceOptions model - createBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.CreateBareMetalServerNetworkInterfaceOptions) - createBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") - createBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePrototype = bareMetalServerNetworkInterfacePrototypeModel - createBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBareMetalServerDisksOptions model + listBareMetalServerDisksOptionsModel := new(vpcv1.ListBareMetalServerDisksOptions) + listBareMetalServerDisksOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerDisksOptionsModel.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.CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.ListBareMetalServerDisks(listBareMetalServerDisksOptionsModel) 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 CreateBareMetalServerNetworkInterfaceOptions model with no property values - createBareMetalServerNetworkInterfaceOptionsModelNew := new(vpcv1.CreateBareMetalServerNetworkInterfaceOptions) + // Construct a second instance of the ListBareMetalServerDisksOptions model with no property values + listBareMetalServerDisksOptionsModelNew := new(vpcv1.ListBareMetalServerDisksOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptionsModelNew) + result, response, operationErr = vpcService.ListBareMetalServerDisks(listBareMetalServerDisksOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -45877,10 +46383,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke CreateBareMetalServerNetworkInterface successfully`, func() { + It(`Invoke ListBareMetalServerDisks successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -45889,38 +46395,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model - networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) - networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // 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 SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype model - bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) - bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerNetworkInterfacePrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-interface") - bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") - - // Construct an instance of the CreateBareMetalServerNetworkInterfaceOptions model - createBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.CreateBareMetalServerNetworkInterfaceOptions) - createBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") - createBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePrototype = bareMetalServerNetworkInterfacePrototypeModel - createBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBareMetalServerDisksOptions model + listBareMetalServerDisksOptionsModel := new(vpcv1.ListBareMetalServerDisksOptions) + listBareMetalServerDisksOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerDisksOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.ListBareMetalServerDisks(listBareMetalServerDisksOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -45932,91 +46413,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteBareMetalServerNetworkInterface(deleteBareMetalServerNetworkInterfaceOptions *DeleteBareMetalServerNetworkInterfaceOptions)`, func() { - version := "testString" - deleteBareMetalServerNetworkInterfacePath := "/bare_metal_servers/testString/network_interfaces/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(deleteBareMetalServerNetworkInterfacePath)) - 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(204) - })) - }) - It(`Invoke DeleteBareMetalServerNetworkInterface 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.DeleteBareMetalServerNetworkInterface(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteBareMetalServerNetworkInterfaceOptions model - deleteBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.DeleteBareMetalServerNetworkInterfaceOptions) - deleteBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") - deleteBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - deleteBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteBareMetalServerNetworkInterface(deleteBareMetalServerNetworkInterfaceOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteBareMetalServerNetworkInterface 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 DeleteBareMetalServerNetworkInterfaceOptions model - deleteBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.DeleteBareMetalServerNetworkInterfaceOptions) - deleteBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") - deleteBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - deleteBareMetalServerNetworkInterfaceOptionsModel.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.DeleteBareMetalServerNetworkInterface(deleteBareMetalServerNetworkInterfaceOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteBareMetalServerNetworkInterfaceOptions model with no property values - deleteBareMetalServerNetworkInterfaceOptionsModelNew := new(vpcv1.DeleteBareMetalServerNetworkInterfaceOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteBareMetalServerNetworkInterface(deleteBareMetalServerNetworkInterfaceOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions) - Operation response error`, func() { + Describe(`GetBareMetalServerDisk(getBareMetalServerDiskOptions *GetBareMetalServerDiskOptions) - Operation response error`, func() { version := "testString" - getBareMetalServerNetworkInterfacePath := "/bare_metal_servers/testString/network_interfaces/testString" + getBareMetalServerDiskPath := "/bare_metal_servers/testString/disks/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(getBareMetalServerNetworkInterfacePath)) + Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerDiskPath)) 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))})) @@ -46025,7 +46431,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetBareMetalServerNetworkInterface with error: Operation response processing error`, func() { + It(`Invoke GetBareMetalServerDisk with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -46034,20 +46440,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBareMetalServerNetworkInterfaceOptions model - getBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceOptions) - getBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBareMetalServerDiskOptions model + getBareMetalServerDiskOptionsModel := new(vpcv1.GetBareMetalServerDiskOptions) + getBareMetalServerDiskOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerDiskOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerDiskOptionsModel.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.GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.GetBareMetalServerDisk(getBareMetalServerDiskOptionsModel) 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.GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptionsModel) + result, response, operationErr = vpcService.GetBareMetalServerDisk(getBareMetalServerDiskOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -46057,16 +46463,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions)`, func() { + Describe(`GetBareMetalServerDisk(getBareMetalServerDiskOptions *GetBareMetalServerDiskOptions)`, func() { version := "testString" - getBareMetalServerNetworkInterfacePath := "/bare_metal_servers/testString/network_interfaces/testString" + getBareMetalServerDiskPath := "/bare_metal_servers/testString/disks/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(getBareMetalServerNetworkInterfacePath)) + Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerDiskPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -46077,10 +46483,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-network-interface", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "network_interface", "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"}], "status": "available", "subnet": {"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"}, "type": "primary", "interface_type": "hipersocket"}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}`) })) }) - It(`Invoke GetBareMetalServerNetworkInterface successfully with retries`, func() { + It(`Invoke GetBareMetalServerDisk successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -46090,22 +46496,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetBareMetalServerNetworkInterfaceOptions model - getBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceOptions) - getBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBareMetalServerDiskOptions model + getBareMetalServerDiskOptionsModel := new(vpcv1.GetBareMetalServerDiskOptions) + getBareMetalServerDiskOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerDiskOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerDiskOptionsModel.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.GetBareMetalServerNetworkInterfaceWithContext(ctx, getBareMetalServerNetworkInterfaceOptionsModel) + _, _, operationErr := vpcService.GetBareMetalServerDiskWithContext(ctx, getBareMetalServerDiskOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.GetBareMetalServerDisk(getBareMetalServerDiskOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -46113,7 +46519,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetBareMetalServerNetworkInterfaceWithContext(ctx, getBareMetalServerNetworkInterfaceOptionsModel) + _, _, operationErr = vpcService.GetBareMetalServerDiskWithContext(ctx, getBareMetalServerDiskOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -46127,7 +46533,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerNetworkInterfacePath)) + Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerDiskPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -46135,10 +46541,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-network-interface", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "network_interface", "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"}], "status": "available", "subnet": {"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"}, "type": "primary", "interface_type": "hipersocket"}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}`) })) }) - It(`Invoke GetBareMetalServerNetworkInterface successfully`, func() { + It(`Invoke GetBareMetalServerDisk successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -46148,25 +46554,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetBareMetalServerNetworkInterface(nil) + result, response, operationErr := vpcService.GetBareMetalServerDisk(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetBareMetalServerNetworkInterfaceOptions model - getBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceOptions) - getBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBareMetalServerDiskOptions model + getBareMetalServerDiskOptionsModel := new(vpcv1.GetBareMetalServerDiskOptions) + getBareMetalServerDiskOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerDiskOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptionsModel) + result, response, operationErr = vpcService.GetBareMetalServerDisk(getBareMetalServerDiskOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetBareMetalServerNetworkInterface with error: Operation validation and request error`, func() { + It(`Invoke GetBareMetalServerDisk with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -46175,23 +46581,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBareMetalServerNetworkInterfaceOptions model - getBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceOptions) - getBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBareMetalServerDiskOptions model + getBareMetalServerDiskOptionsModel := new(vpcv1.GetBareMetalServerDiskOptions) + getBareMetalServerDiskOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerDiskOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerDiskOptionsModel.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.GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.GetBareMetalServerDisk(getBareMetalServerDiskOptionsModel) 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 GetBareMetalServerNetworkInterfaceOptions model with no property values - getBareMetalServerNetworkInterfaceOptionsModelNew := new(vpcv1.GetBareMetalServerNetworkInterfaceOptions) + // Construct a second instance of the GetBareMetalServerDiskOptions model with no property values + getBareMetalServerDiskOptionsModelNew := new(vpcv1.GetBareMetalServerDiskOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptionsModelNew) + result, response, operationErr = vpcService.GetBareMetalServerDisk(getBareMetalServerDiskOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -46209,7 +46615,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetBareMetalServerNetworkInterface successfully`, func() { + It(`Invoke GetBareMetalServerDisk successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -46218,14 +46624,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBareMetalServerNetworkInterfaceOptions model - getBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceOptions) - getBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBareMetalServerDiskOptions model + getBareMetalServerDiskOptionsModel := new(vpcv1.GetBareMetalServerDiskOptions) + getBareMetalServerDiskOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerDiskOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.GetBareMetalServerDisk(getBareMetalServerDiskOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -46237,16 +46643,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions) - Operation response error`, func() { + Describe(`UpdateBareMetalServerDisk(updateBareMetalServerDiskOptions *UpdateBareMetalServerDiskOptions) - Operation response error`, func() { version := "testString" - updateBareMetalServerNetworkInterfacePath := "/bare_metal_servers/testString/network_interfaces/testString" + updateBareMetalServerDiskPath := "/bare_metal_servers/testString/disks/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(updateBareMetalServerNetworkInterfacePath)) + Expect(req.URL.EscapedPath()).To(Equal(updateBareMetalServerDiskPath)) 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))})) @@ -46255,7 +46661,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateBareMetalServerNetworkInterface with error: Operation response processing error`, func() { + It(`Invoke UpdateBareMetalServerDisk with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -46264,30 +46670,27 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the BareMetalServerNetworkInterfacePatch model - bareMetalServerNetworkInterfacePatchModel := new(vpcv1.BareMetalServerNetworkInterfacePatch) - bareMetalServerNetworkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerNetworkInterfacePatchModel.AllowedVlans = []int64{int64(4)} - bareMetalServerNetworkInterfacePatchModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerNetworkInterfacePatchModel.Name = core.StringPtr("my-bare-metal-server-network-interface") - bareMetalServerNetworkInterfacePatchModelAsPatch, asPatchErr := bareMetalServerNetworkInterfacePatchModel.AsPatch() + // Construct an instance of the BareMetalServerDiskPatch model + bareMetalServerDiskPatchModel := new(vpcv1.BareMetalServerDiskPatch) + bareMetalServerDiskPatchModel.Name = core.StringPtr("my-bare-metal-server-disk-updated") + bareMetalServerDiskPatchModelAsPatch, asPatchErr := bareMetalServerDiskPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateBareMetalServerNetworkInterfaceOptions model - updateBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.UpdateBareMetalServerNetworkInterfaceOptions) - updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") - updateBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePatch = bareMetalServerNetworkInterfacePatchModelAsPatch - updateBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateBareMetalServerDiskOptions model + updateBareMetalServerDiskOptionsModel := new(vpcv1.UpdateBareMetalServerDiskOptions) + updateBareMetalServerDiskOptionsModel.BareMetalServerID = core.StringPtr("testString") + updateBareMetalServerDiskOptionsModel.ID = core.StringPtr("testString") + updateBareMetalServerDiskOptionsModel.BareMetalServerDiskPatch = bareMetalServerDiskPatchModelAsPatch + updateBareMetalServerDiskOptionsModel.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.UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.UpdateBareMetalServerDisk(updateBareMetalServerDiskOptionsModel) 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.UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptionsModel) + result, response, operationErr = vpcService.UpdateBareMetalServerDisk(updateBareMetalServerDiskOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -46297,16 +46700,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions)`, func() { + Describe(`UpdateBareMetalServerDisk(updateBareMetalServerDiskOptions *UpdateBareMetalServerDiskOptions)`, func() { version := "testString" - updateBareMetalServerNetworkInterfacePath := "/bare_metal_servers/testString/network_interfaces/testString" + updateBareMetalServerDiskPath := "/bare_metal_servers/testString/disks/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(updateBareMetalServerNetworkInterfacePath)) + Expect(req.URL.EscapedPath()).To(Equal(updateBareMetalServerDiskPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -46333,10 +46736,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-network-interface", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "network_interface", "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"}], "status": "available", "subnet": {"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"}, "type": "primary", "interface_type": "hipersocket"}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}`) })) }) - It(`Invoke UpdateBareMetalServerNetworkInterface successfully with retries`, func() { + It(`Invoke UpdateBareMetalServerDisk successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -46346,32 +46749,29 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the BareMetalServerNetworkInterfacePatch model - bareMetalServerNetworkInterfacePatchModel := new(vpcv1.BareMetalServerNetworkInterfacePatch) - bareMetalServerNetworkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerNetworkInterfacePatchModel.AllowedVlans = []int64{int64(4)} - bareMetalServerNetworkInterfacePatchModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerNetworkInterfacePatchModel.Name = core.StringPtr("my-bare-metal-server-network-interface") - bareMetalServerNetworkInterfacePatchModelAsPatch, asPatchErr := bareMetalServerNetworkInterfacePatchModel.AsPatch() + // Construct an instance of the BareMetalServerDiskPatch model + bareMetalServerDiskPatchModel := new(vpcv1.BareMetalServerDiskPatch) + bareMetalServerDiskPatchModel.Name = core.StringPtr("my-bare-metal-server-disk-updated") + bareMetalServerDiskPatchModelAsPatch, asPatchErr := bareMetalServerDiskPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateBareMetalServerNetworkInterfaceOptions model - updateBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.UpdateBareMetalServerNetworkInterfaceOptions) - updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") - updateBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePatch = bareMetalServerNetworkInterfacePatchModelAsPatch - updateBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateBareMetalServerDiskOptions model + updateBareMetalServerDiskOptionsModel := new(vpcv1.UpdateBareMetalServerDiskOptions) + updateBareMetalServerDiskOptionsModel.BareMetalServerID = core.StringPtr("testString") + updateBareMetalServerDiskOptionsModel.ID = core.StringPtr("testString") + updateBareMetalServerDiskOptionsModel.BareMetalServerDiskPatch = bareMetalServerDiskPatchModelAsPatch + updateBareMetalServerDiskOptionsModel.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.UpdateBareMetalServerNetworkInterfaceWithContext(ctx, updateBareMetalServerNetworkInterfaceOptionsModel) + _, _, operationErr := vpcService.UpdateBareMetalServerDiskWithContext(ctx, updateBareMetalServerDiskOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.UpdateBareMetalServerDisk(updateBareMetalServerDiskOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -46379,7 +46779,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateBareMetalServerNetworkInterfaceWithContext(ctx, updateBareMetalServerNetworkInterfaceOptionsModel) + _, _, operationErr = vpcService.UpdateBareMetalServerDiskWithContext(ctx, updateBareMetalServerDiskOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -46393,7 +46793,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateBareMetalServerNetworkInterfacePath)) + Expect(req.URL.EscapedPath()).To(Equal(updateBareMetalServerDiskPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -46417,10 +46817,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-network-interface", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "network_interface", "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"}], "status": "available", "subnet": {"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"}, "type": "primary", "interface_type": "hipersocket"}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}`) })) }) - It(`Invoke UpdateBareMetalServerNetworkInterface successfully`, func() { + It(`Invoke UpdateBareMetalServerDisk successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -46430,35 +46830,32 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateBareMetalServerNetworkInterface(nil) + result, response, operationErr := vpcService.UpdateBareMetalServerDisk(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the BareMetalServerNetworkInterfacePatch model - bareMetalServerNetworkInterfacePatchModel := new(vpcv1.BareMetalServerNetworkInterfacePatch) - bareMetalServerNetworkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerNetworkInterfacePatchModel.AllowedVlans = []int64{int64(4)} - bareMetalServerNetworkInterfacePatchModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerNetworkInterfacePatchModel.Name = core.StringPtr("my-bare-metal-server-network-interface") - bareMetalServerNetworkInterfacePatchModelAsPatch, asPatchErr := bareMetalServerNetworkInterfacePatchModel.AsPatch() + // Construct an instance of the BareMetalServerDiskPatch model + bareMetalServerDiskPatchModel := new(vpcv1.BareMetalServerDiskPatch) + bareMetalServerDiskPatchModel.Name = core.StringPtr("my-bare-metal-server-disk-updated") + bareMetalServerDiskPatchModelAsPatch, asPatchErr := bareMetalServerDiskPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateBareMetalServerNetworkInterfaceOptions model - updateBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.UpdateBareMetalServerNetworkInterfaceOptions) - updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") - updateBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePatch = bareMetalServerNetworkInterfacePatchModelAsPatch - updateBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateBareMetalServerDiskOptions model + updateBareMetalServerDiskOptionsModel := new(vpcv1.UpdateBareMetalServerDiskOptions) + updateBareMetalServerDiskOptionsModel.BareMetalServerID = core.StringPtr("testString") + updateBareMetalServerDiskOptionsModel.ID = core.StringPtr("testString") + updateBareMetalServerDiskOptionsModel.BareMetalServerDiskPatch = bareMetalServerDiskPatchModelAsPatch + updateBareMetalServerDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptionsModel) + result, response, operationErr = vpcService.UpdateBareMetalServerDisk(updateBareMetalServerDiskOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateBareMetalServerNetworkInterface with error: Operation validation and request error`, func() { + It(`Invoke UpdateBareMetalServerDisk with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -46467,33 +46864,30 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the BareMetalServerNetworkInterfacePatch model - bareMetalServerNetworkInterfacePatchModel := new(vpcv1.BareMetalServerNetworkInterfacePatch) - bareMetalServerNetworkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerNetworkInterfacePatchModel.AllowedVlans = []int64{int64(4)} - bareMetalServerNetworkInterfacePatchModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerNetworkInterfacePatchModel.Name = core.StringPtr("my-bare-metal-server-network-interface") - bareMetalServerNetworkInterfacePatchModelAsPatch, asPatchErr := bareMetalServerNetworkInterfacePatchModel.AsPatch() + // Construct an instance of the BareMetalServerDiskPatch model + bareMetalServerDiskPatchModel := new(vpcv1.BareMetalServerDiskPatch) + bareMetalServerDiskPatchModel.Name = core.StringPtr("my-bare-metal-server-disk-updated") + bareMetalServerDiskPatchModelAsPatch, asPatchErr := bareMetalServerDiskPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateBareMetalServerNetworkInterfaceOptions model - updateBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.UpdateBareMetalServerNetworkInterfaceOptions) - updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") - updateBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePatch = bareMetalServerNetworkInterfacePatchModelAsPatch - updateBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateBareMetalServerDiskOptions model + updateBareMetalServerDiskOptionsModel := new(vpcv1.UpdateBareMetalServerDiskOptions) + updateBareMetalServerDiskOptionsModel.BareMetalServerID = core.StringPtr("testString") + updateBareMetalServerDiskOptionsModel.ID = core.StringPtr("testString") + updateBareMetalServerDiskOptionsModel.BareMetalServerDiskPatch = bareMetalServerDiskPatchModelAsPatch + updateBareMetalServerDiskOptionsModel.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.UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.UpdateBareMetalServerDisk(updateBareMetalServerDiskOptionsModel) 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 UpdateBareMetalServerNetworkInterfaceOptions model with no property values - updateBareMetalServerNetworkInterfaceOptionsModelNew := new(vpcv1.UpdateBareMetalServerNetworkInterfaceOptions) + // Construct a second instance of the UpdateBareMetalServerDiskOptions model with no property values + updateBareMetalServerDiskOptionsModelNew := new(vpcv1.UpdateBareMetalServerDiskOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptionsModelNew) + result, response, operationErr = vpcService.UpdateBareMetalServerDisk(updateBareMetalServerDiskOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -46511,7 +46905,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateBareMetalServerNetworkInterface successfully`, func() { + It(`Invoke UpdateBareMetalServerDisk successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -46520,24 +46914,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the BareMetalServerNetworkInterfacePatch model - bareMetalServerNetworkInterfacePatchModel := new(vpcv1.BareMetalServerNetworkInterfacePatch) - bareMetalServerNetworkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerNetworkInterfacePatchModel.AllowedVlans = []int64{int64(4)} - bareMetalServerNetworkInterfacePatchModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerNetworkInterfacePatchModel.Name = core.StringPtr("my-bare-metal-server-network-interface") - bareMetalServerNetworkInterfacePatchModelAsPatch, asPatchErr := bareMetalServerNetworkInterfacePatchModel.AsPatch() + // Construct an instance of the BareMetalServerDiskPatch model + bareMetalServerDiskPatchModel := new(vpcv1.BareMetalServerDiskPatch) + bareMetalServerDiskPatchModel.Name = core.StringPtr("my-bare-metal-server-disk-updated") + bareMetalServerDiskPatchModelAsPatch, asPatchErr := bareMetalServerDiskPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateBareMetalServerNetworkInterfaceOptions model - updateBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.UpdateBareMetalServerNetworkInterfaceOptions) - updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") - updateBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePatch = bareMetalServerNetworkInterfacePatchModelAsPatch - updateBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateBareMetalServerDiskOptions model + updateBareMetalServerDiskOptionsModel := new(vpcv1.UpdateBareMetalServerDiskOptions) + updateBareMetalServerDiskOptionsModel.BareMetalServerID = core.StringPtr("testString") + updateBareMetalServerDiskOptionsModel.ID = core.StringPtr("testString") + updateBareMetalServerDiskOptionsModel.BareMetalServerDiskPatch = bareMetalServerDiskPatchModelAsPatch + updateBareMetalServerDiskOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.UpdateBareMetalServerDisk(updateBareMetalServerDiskOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -46549,25 +46940,27 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) - Operation response error`, func() { + Describe(`ListBareMetalServerNetworkAttachments(listBareMetalServerNetworkAttachmentsOptions *ListBareMetalServerNetworkAttachmentsOptions) - Operation response error`, func() { version := "testString" - listBareMetalServerNetworkInterfaceFloatingIpsPath := "/bare_metal_servers/testString/network_interfaces/testString/floating_ips" + listBareMetalServerNetworkAttachmentsPath := "/bare_metal_servers/testString/network_attachments" 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(listBareMetalServerNetworkInterfaceFloatingIpsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerNetworkAttachmentsPath)) 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(10))})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListBareMetalServerNetworkInterfaceFloatingIps with error: Operation response processing error`, func() { + It(`Invoke ListBareMetalServerNetworkAttachments with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -46576,20 +46969,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBareMetalServerNetworkInterfaceFloatingIpsOptions model - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfaceFloatingIpsOptions) - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBareMetalServerNetworkAttachmentsOptions model + listBareMetalServerNetworkAttachmentsOptionsModel := new(vpcv1.ListBareMetalServerNetworkAttachmentsOptions) + listBareMetalServerNetworkAttachmentsOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerNetworkAttachmentsOptionsModel.Start = core.StringPtr("testString") + listBareMetalServerNetworkAttachmentsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBareMetalServerNetworkAttachmentsOptionsModel.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.ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel) + result, response, operationErr := vpcService.ListBareMetalServerNetworkAttachments(listBareMetalServerNetworkAttachmentsOptionsModel) 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.ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel) + result, response, operationErr = vpcService.ListBareMetalServerNetworkAttachments(listBareMetalServerNetworkAttachmentsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -46599,30 +46993,32 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions)`, func() { + Describe(`ListBareMetalServerNetworkAttachments(listBareMetalServerNetworkAttachmentsOptions *ListBareMetalServerNetworkAttachmentsOptions)`, func() { version := "testString" - listBareMetalServerNetworkInterfaceFloatingIpsPath := "/bare_metal_servers/testString/network_interfaces/testString/floating_ips" + listBareMetalServerNetworkAttachmentsPath := "/bare_metal_servers/testString/network_attachments" 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(listBareMetalServerNetworkInterfaceFloatingIpsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerNetworkAttachmentsPath)) 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(10))})) // 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", `{"floating_ips": [{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface"}, "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", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/3b2669a2-4c2b-4003-bc91-1b81f1326267/network_attachments?limit=20"}, "limit": 20, "network_attachments": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "lifecycle_state": "stable", "name": "my-bare-metal-server-network-attachment", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"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"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "allowed_vlans": [4], "interface_type": "pci"}], "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/3b2669a2-4c2b-4003-bc91-1b81f1326267/network_attachments?start=d3e721fd-c988-4670-9927-dbd5e7b07fc6&limit=20"}, "total_count": 132}`) })) }) - It(`Invoke ListBareMetalServerNetworkInterfaceFloatingIps successfully with retries`, func() { + It(`Invoke ListBareMetalServerNetworkAttachments successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -46632,22 +47028,23 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListBareMetalServerNetworkInterfaceFloatingIpsOptions model - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfaceFloatingIpsOptions) - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBareMetalServerNetworkAttachmentsOptions model + listBareMetalServerNetworkAttachmentsOptionsModel := new(vpcv1.ListBareMetalServerNetworkAttachmentsOptions) + listBareMetalServerNetworkAttachmentsOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerNetworkAttachmentsOptionsModel.Start = core.StringPtr("testString") + listBareMetalServerNetworkAttachmentsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBareMetalServerNetworkAttachmentsOptionsModel.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.ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(ctx, listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel) + _, _, operationErr := vpcService.ListBareMetalServerNetworkAttachmentsWithContext(ctx, listBareMetalServerNetworkAttachmentsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel) + result, response, operationErr := vpcService.ListBareMetalServerNetworkAttachments(listBareMetalServerNetworkAttachmentsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -46655,7 +47052,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(ctx, listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel) + _, _, operationErr = vpcService.ListBareMetalServerNetworkAttachmentsWithContext(ctx, listBareMetalServerNetworkAttachmentsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -46669,18 +47066,20 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerNetworkInterfaceFloatingIpsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerNetworkAttachmentsPath)) 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(10))})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"floating_ips": [{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface"}, "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", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/3b2669a2-4c2b-4003-bc91-1b81f1326267/network_attachments?limit=20"}, "limit": 20, "network_attachments": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "lifecycle_state": "stable", "name": "my-bare-metal-server-network-attachment", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"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"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "allowed_vlans": [4], "interface_type": "pci"}], "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/3b2669a2-4c2b-4003-bc91-1b81f1326267/network_attachments?start=d3e721fd-c988-4670-9927-dbd5e7b07fc6&limit=20"}, "total_count": 132}`) })) }) - It(`Invoke ListBareMetalServerNetworkInterfaceFloatingIps successfully`, func() { + It(`Invoke ListBareMetalServerNetworkAttachments successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -46690,25 +47089,26 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaceFloatingIps(nil) + result, response, operationErr := vpcService.ListBareMetalServerNetworkAttachments(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListBareMetalServerNetworkInterfaceFloatingIpsOptions model - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfaceFloatingIpsOptions) - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBareMetalServerNetworkAttachmentsOptions model + listBareMetalServerNetworkAttachmentsOptionsModel := new(vpcv1.ListBareMetalServerNetworkAttachmentsOptions) + listBareMetalServerNetworkAttachmentsOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerNetworkAttachmentsOptionsModel.Start = core.StringPtr("testString") + listBareMetalServerNetworkAttachmentsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBareMetalServerNetworkAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel) + result, response, operationErr = vpcService.ListBareMetalServerNetworkAttachments(listBareMetalServerNetworkAttachmentsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListBareMetalServerNetworkInterfaceFloatingIps with error: Operation validation and request error`, func() { + It(`Invoke ListBareMetalServerNetworkAttachments with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -46717,23 +47117,24 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBareMetalServerNetworkInterfaceFloatingIpsOptions model - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfaceFloatingIpsOptions) - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBareMetalServerNetworkAttachmentsOptions model + listBareMetalServerNetworkAttachmentsOptionsModel := new(vpcv1.ListBareMetalServerNetworkAttachmentsOptions) + listBareMetalServerNetworkAttachmentsOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerNetworkAttachmentsOptionsModel.Start = core.StringPtr("testString") + listBareMetalServerNetworkAttachmentsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBareMetalServerNetworkAttachmentsOptionsModel.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.ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel) + result, response, operationErr := vpcService.ListBareMetalServerNetworkAttachments(listBareMetalServerNetworkAttachmentsOptionsModel) 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 ListBareMetalServerNetworkInterfaceFloatingIpsOptions model with no property values - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModelNew := new(vpcv1.ListBareMetalServerNetworkInterfaceFloatingIpsOptions) + // Construct a second instance of the ListBareMetalServerNetworkAttachmentsOptions model with no property values + listBareMetalServerNetworkAttachmentsOptionsModelNew := new(vpcv1.ListBareMetalServerNetworkAttachmentsOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptionsModelNew) + result, response, operationErr = vpcService.ListBareMetalServerNetworkAttachments(listBareMetalServerNetworkAttachmentsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -46751,7 +47152,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListBareMetalServerNetworkInterfaceFloatingIps successfully`, func() { + It(`Invoke ListBareMetalServerNetworkAttachments successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -46760,14 +47161,15 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListBareMetalServerNetworkInterfaceFloatingIpsOptions model - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfaceFloatingIpsOptions) - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBareMetalServerNetworkAttachmentsOptions model + listBareMetalServerNetworkAttachmentsOptionsModel := new(vpcv1.ListBareMetalServerNetworkAttachmentsOptions) + listBareMetalServerNetworkAttachmentsOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerNetworkAttachmentsOptionsModel.Start = core.StringPtr("testString") + listBareMetalServerNetworkAttachmentsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBareMetalServerNetworkAttachmentsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel) + result, response, operationErr := vpcService.ListBareMetalServerNetworkAttachments(listBareMetalServerNetworkAttachmentsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -46778,25 +47180,59 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) - }) - Describe(`RemoveBareMetalServerNetworkInterfaceFloatingIP(removeBareMetalServerNetworkInterfaceFloatingIPOptions *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions)`, func() { - version := "testString" - removeBareMetalServerNetworkInterfaceFloatingIPPath := "/bare_metal_servers/testString/network_interfaces/testString/floating_ips/testString" - Context(`Using mock server endpoint`, func() { + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(vpcv1.BareMetalServerNetworkAttachmentCollection) + nextObject := new(vpcv1.BareMetalServerNetworkAttachmentCollectionNext) + 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.BareMetalServerNetworkAttachmentCollection) + + 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.BareMetalServerNetworkAttachmentCollection) + nextObject := new(vpcv1.BareMetalServerNetworkAttachmentCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { BeforeEach(func() { + var requestNumber int = 0 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(removeBareMetalServerNetworkInterfaceFloatingIPPath)) - Expect(req.Method).To(Equal("DELETE")) + Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerNetworkAttachmentsPath)) + 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.WriteHeader(204) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"network_attachments":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","lifecycle_state":"stable","name":"my-bare-metal-server-network-attachment","port_speed":1000,"primary_ip":{"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"},"resource_type":"bare_metal_server_network_attachment","subnet":{"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"},"type":"primary","virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","id":"0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"},"allowed_vlans":[4],"interface_type":"pci"}]}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"network_attachments":[{"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","id":"2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6","lifecycle_state":"stable","name":"my-bare-metal-server-network-attachment","port_speed":1000,"primary_ip":{"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"},"resource_type":"bare_metal_server_network_attachment","subnet":{"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"},"type":"primary","virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","id":"0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"},"allowed_vlans":[4],"interface_type":"pci"}]}`) + } else { + res.WriteHeader(400) + } })) }) - It(`Invoke RemoveBareMetalServerNetworkInterfaceFloatingIP successfully`, func() { + It(`Use BareMetalServerNetworkAttachmentsPager.GetNext successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -46805,24 +47241,25 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.RemoveBareMetalServerNetworkInterfaceFloatingIP(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) + listBareMetalServerNetworkAttachmentsOptionsModel := &vpcv1.ListBareMetalServerNetworkAttachmentsOptions{ + BareMetalServerID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + } - // Construct an instance of the RemoveBareMetalServerNetworkInterfaceFloatingIPOptions model - removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) - removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") - removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + pager, err := vpcService.NewBareMetalServerNetworkAttachmentsPager(listBareMetalServerNetworkAttachmentsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.RemoveBareMetalServerNetworkInterfaceFloatingIP(removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) + var allResults []vpcv1.BareMetalServerNetworkAttachmentIntf + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) }) - It(`Invoke RemoveBareMetalServerNetworkInterfaceFloatingIP with error: Operation validation and request error`, func() { + It(`Use BareMetalServerNetworkAttachmentsPager.GetAll successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -46831,50 +47268,41 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the RemoveBareMetalServerNetworkInterfaceFloatingIPOptions model - removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) - removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") - removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := vpcService.SetServiceURL("") + listBareMetalServerNetworkAttachmentsOptionsModel := &vpcv1.ListBareMetalServerNetworkAttachmentsOptions{ + BareMetalServerID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewBareMetalServerNetworkAttachmentsPager(listBareMetalServerNetworkAttachmentsOptionsModel) Expect(err).To(BeNil()) - response, operationErr := vpcService.RemoveBareMetalServerNetworkInterfaceFloatingIP(removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the RemoveBareMetalServerNetworkInterfaceFloatingIPOptions model with no property values - removeBareMetalServerNetworkInterfaceFloatingIPOptionsModelNew := new(vpcv1.RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.RemoveBareMetalServerNetworkInterfaceFloatingIP(removeBareMetalServerNetworkInterfaceFloatingIPOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) }) }) }) - Describe(`GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions) - Operation response error`, func() { + Describe(`CreateBareMetalServerNetworkAttachment(createBareMetalServerNetworkAttachmentOptions *CreateBareMetalServerNetworkAttachmentOptions) - Operation response error`, func() { version := "testString" - getBareMetalServerNetworkInterfaceFloatingIPPath := "/bare_metal_servers/testString/network_interfaces/testString/floating_ips/testString" + createBareMetalServerNetworkAttachmentPath := "/bare_metal_servers/testString/network_attachments" 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(getBareMetalServerNetworkInterfaceFloatingIPPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createBareMetalServerNetworkAttachmentPath)) + 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(200) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetBareMetalServerNetworkInterfaceFloatingIP with error: Operation response processing error`, func() { + It(`Invoke CreateBareMetalServerNetworkAttachment with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -46883,21 +47311,63 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBareMetalServerNetworkInterfaceFloatingIPOptions model - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceFloatingIPOptions) - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // 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 SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext model + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + + // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype model + bareMetalServerNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) + bareMetalServerNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") + bareMetalServerNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + bareMetalServerNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} + bareMetalServerNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") + + // Construct an instance of the CreateBareMetalServerNetworkAttachmentOptions model + createBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.CreateBareMetalServerNetworkAttachmentOptions) + createBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") + createBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerNetworkAttachmentPrototype = bareMetalServerNetworkAttachmentPrototypeModel + createBareMetalServerNetworkAttachmentOptionsModel.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.GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr := vpcService.CreateBareMetalServerNetworkAttachment(createBareMetalServerNetworkAttachmentOptionsModel) 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.GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr = vpcService.CreateBareMetalServerNetworkAttachment(createBareMetalServerNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -46907,17 +47377,33 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions)`, func() { + Describe(`CreateBareMetalServerNetworkAttachment(createBareMetalServerNetworkAttachmentOptions *CreateBareMetalServerNetworkAttachmentOptions)`, func() { version := "testString" - getBareMetalServerNetworkInterfaceFloatingIPPath := "/bare_metal_servers/testString/network_interfaces/testString/floating_ips/testString" + createBareMetalServerNetworkAttachmentPath := "/bare_metal_servers/testString/network_attachments" 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(getBareMetalServerNetworkInterfaceFloatingIPPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createBareMetalServerNetworkAttachmentPath)) + 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))})) @@ -46926,11 +47412,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "lifecycle_state": "stable", "name": "my-bare-metal-server-network-attachment", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"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"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "allowed_vlans": [4], "interface_type": "pci"}`) })) }) - It(`Invoke GetBareMetalServerNetworkInterfaceFloatingIP successfully with retries`, func() { + It(`Invoke CreateBareMetalServerNetworkAttachment successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -46940,23 +47426,65 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetBareMetalServerNetworkInterfaceFloatingIPOptions model - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceFloatingIPOptions) - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // 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 SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext model + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + + // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype model + bareMetalServerNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) + bareMetalServerNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") + bareMetalServerNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + bareMetalServerNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} + bareMetalServerNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") + + // Construct an instance of the CreateBareMetalServerNetworkAttachmentOptions model + createBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.CreateBareMetalServerNetworkAttachmentOptions) + createBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") + createBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerNetworkAttachmentPrototype = bareMetalServerNetworkAttachmentPrototypeModel + createBareMetalServerNetworkAttachmentOptionsModel.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.GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx, getBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + _, _, operationErr := vpcService.CreateBareMetalServerNetworkAttachmentWithContext(ctx, createBareMetalServerNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr := vpcService.CreateBareMetalServerNetworkAttachment(createBareMetalServerNetworkAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -46964,7 +47492,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx, getBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + _, _, operationErr = vpcService.CreateBareMetalServerNetworkAttachmentWithContext(ctx, createBareMetalServerNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -46978,18 +47506,34 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerNetworkInterfaceFloatingIPPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createBareMetalServerNetworkAttachmentPath)) + 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(200) - fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "lifecycle_state": "stable", "name": "my-bare-metal-server-network-attachment", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"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"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "allowed_vlans": [4], "interface_type": "pci"}`) })) }) - It(`Invoke GetBareMetalServerNetworkInterfaceFloatingIP successfully`, func() { + It(`Invoke CreateBareMetalServerNetworkAttachment successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -46999,26 +47543,68 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetBareMetalServerNetworkInterfaceFloatingIP(nil) + result, response, operationErr := vpcService.CreateBareMetalServerNetworkAttachment(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetBareMetalServerNetworkInterfaceFloatingIPOptions model - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceFloatingIPOptions) - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // 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 SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext model + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + + // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype model + bareMetalServerNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) + bareMetalServerNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") + bareMetalServerNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + bareMetalServerNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} + bareMetalServerNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") + + // Construct an instance of the CreateBareMetalServerNetworkAttachmentOptions model + createBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.CreateBareMetalServerNetworkAttachmentOptions) + createBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") + createBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerNetworkAttachmentPrototype = bareMetalServerNetworkAttachmentPrototypeModel + createBareMetalServerNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr = vpcService.CreateBareMetalServerNetworkAttachment(createBareMetalServerNetworkAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetBareMetalServerNetworkInterfaceFloatingIP with error: Operation validation and request error`, func() { + It(`Invoke CreateBareMetalServerNetworkAttachment with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -47027,24 +47613,66 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBareMetalServerNetworkInterfaceFloatingIPOptions model - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceFloatingIPOptions) - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // 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 SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext model + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + + // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype model + bareMetalServerNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) + bareMetalServerNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") + bareMetalServerNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + bareMetalServerNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} + bareMetalServerNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") + + // Construct an instance of the CreateBareMetalServerNetworkAttachmentOptions model + createBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.CreateBareMetalServerNetworkAttachmentOptions) + createBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") + createBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerNetworkAttachmentPrototype = bareMetalServerNetworkAttachmentPrototypeModel + createBareMetalServerNetworkAttachmentOptionsModel.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.GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr := vpcService.CreateBareMetalServerNetworkAttachment(createBareMetalServerNetworkAttachmentOptionsModel) 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 GetBareMetalServerNetworkInterfaceFloatingIPOptions model with no property values - getBareMetalServerNetworkInterfaceFloatingIPOptionsModelNew := new(vpcv1.GetBareMetalServerNetworkInterfaceFloatingIPOptions) + // Construct a second instance of the CreateBareMetalServerNetworkAttachmentOptions model with no property values + createBareMetalServerNetworkAttachmentOptionsModelNew := new(vpcv1.CreateBareMetalServerNetworkAttachmentOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptionsModelNew) + result, response, operationErr = vpcService.CreateBareMetalServerNetworkAttachment(createBareMetalServerNetworkAttachmentOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -47059,10 +47687,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke GetBareMetalServerNetworkInterfaceFloatingIP successfully`, func() { + It(`Invoke CreateBareMetalServerNetworkAttachment successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -47071,15 +47699,57 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBareMetalServerNetworkInterfaceFloatingIPOptions model - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceFloatingIPOptions) - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // 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 SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext model + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + + // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype model + bareMetalServerNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) + bareMetalServerNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") + bareMetalServerNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + bareMetalServerNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} + bareMetalServerNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") + + // Construct an instance of the CreateBareMetalServerNetworkAttachmentOptions model + createBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.CreateBareMetalServerNetworkAttachmentOptions) + createBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") + createBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerNetworkAttachmentPrototype = bareMetalServerNetworkAttachmentPrototypeModel + createBareMetalServerNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr := vpcService.CreateBareMetalServerNetworkAttachment(createBareMetalServerNetworkAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -47091,25 +47761,100 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions) - Operation response error`, func() { + Describe(`DeleteBareMetalServerNetworkAttachment(deleteBareMetalServerNetworkAttachmentOptions *DeleteBareMetalServerNetworkAttachmentOptions)`, func() { version := "testString" - addBareMetalServerNetworkInterfaceFloatingIPPath := "/bare_metal_servers/testString/network_interfaces/testString/floating_ips/testString" + deleteBareMetalServerNetworkAttachmentPath := "/bare_metal_servers/testString/network_attachments/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(deleteBareMetalServerNetworkAttachmentPath)) + 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 DeleteBareMetalServerNetworkAttachment 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.DeleteBareMetalServerNetworkAttachment(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteBareMetalServerNetworkAttachmentOptions model + deleteBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.DeleteBareMetalServerNetworkAttachmentOptions) + deleteBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") + deleteBareMetalServerNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + deleteBareMetalServerNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteBareMetalServerNetworkAttachment(deleteBareMetalServerNetworkAttachmentOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteBareMetalServerNetworkAttachment 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 DeleteBareMetalServerNetworkAttachmentOptions model + deleteBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.DeleteBareMetalServerNetworkAttachmentOptions) + deleteBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") + deleteBareMetalServerNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + deleteBareMetalServerNetworkAttachmentOptionsModel.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.DeleteBareMetalServerNetworkAttachment(deleteBareMetalServerNetworkAttachmentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteBareMetalServerNetworkAttachmentOptions model with no property values + deleteBareMetalServerNetworkAttachmentOptionsModelNew := new(vpcv1.DeleteBareMetalServerNetworkAttachmentOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteBareMetalServerNetworkAttachment(deleteBareMetalServerNetworkAttachmentOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetBareMetalServerNetworkAttachment(getBareMetalServerNetworkAttachmentOptions *GetBareMetalServerNetworkAttachmentOptions) - Operation response error`, func() { + version := "testString" + getBareMetalServerNetworkAttachmentPath := "/bare_metal_servers/testString/network_attachments/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(addBareMetalServerNetworkInterfaceFloatingIPPath)) - Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerNetworkAttachmentPath)) + 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(201) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke AddBareMetalServerNetworkInterfaceFloatingIP with error: Operation response processing error`, func() { + It(`Invoke GetBareMetalServerNetworkAttachment with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -47118,21 +47863,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the AddBareMetalServerNetworkInterfaceFloatingIPOptions model - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddBareMetalServerNetworkInterfaceFloatingIPOptions) - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBareMetalServerNetworkAttachmentOptions model + getBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.GetBareMetalServerNetworkAttachmentOptions) + getBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerNetworkAttachmentOptionsModel.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.AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr := vpcService.GetBareMetalServerNetworkAttachment(getBareMetalServerNetworkAttachmentOptionsModel) 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.AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr = vpcService.GetBareMetalServerNetworkAttachment(getBareMetalServerNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -47142,17 +47886,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions)`, func() { + Describe(`GetBareMetalServerNetworkAttachment(getBareMetalServerNetworkAttachmentOptions *GetBareMetalServerNetworkAttachmentOptions)`, func() { version := "testString" - addBareMetalServerNetworkInterfaceFloatingIPPath := "/bare_metal_servers/testString/network_interfaces/testString/floating_ips/testString" + getBareMetalServerNetworkAttachmentPath := "/bare_metal_servers/testString/network_attachments/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(addBareMetalServerNetworkInterfaceFloatingIPPath)) - Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerNetworkAttachmentPath)) + 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))})) @@ -47161,11 +47905,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "lifecycle_state": "stable", "name": "my-bare-metal-server-network-attachment", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"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"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "allowed_vlans": [4], "interface_type": "pci"}`) })) }) - It(`Invoke AddBareMetalServerNetworkInterfaceFloatingIP successfully with retries`, func() { + It(`Invoke GetBareMetalServerNetworkAttachment successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -47175,23 +47919,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the AddBareMetalServerNetworkInterfaceFloatingIPOptions model - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddBareMetalServerNetworkInterfaceFloatingIPOptions) - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBareMetalServerNetworkAttachmentOptions model + getBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.GetBareMetalServerNetworkAttachmentOptions) + getBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerNetworkAttachmentOptionsModel.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.AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx, addBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + _, _, operationErr := vpcService.GetBareMetalServerNetworkAttachmentWithContext(ctx, getBareMetalServerNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr := vpcService.GetBareMetalServerNetworkAttachment(getBareMetalServerNetworkAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -47199,7 +47942,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx, addBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + _, _, operationErr = vpcService.GetBareMetalServerNetworkAttachmentWithContext(ctx, getBareMetalServerNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -47213,18 +47956,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(addBareMetalServerNetworkInterfaceFloatingIPPath)) - Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerNetworkAttachmentPath)) + 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(201) - fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "lifecycle_state": "stable", "name": "my-bare-metal-server-network-attachment", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"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"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "allowed_vlans": [4], "interface_type": "pci"}`) })) }) - It(`Invoke AddBareMetalServerNetworkInterfaceFloatingIP successfully`, func() { + It(`Invoke GetBareMetalServerNetworkAttachment successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -47234,26 +47977,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.AddBareMetalServerNetworkInterfaceFloatingIP(nil) + result, response, operationErr := vpcService.GetBareMetalServerNetworkAttachment(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the AddBareMetalServerNetworkInterfaceFloatingIPOptions model - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddBareMetalServerNetworkInterfaceFloatingIPOptions) - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBareMetalServerNetworkAttachmentOptions model + getBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.GetBareMetalServerNetworkAttachmentOptions) + getBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr = vpcService.GetBareMetalServerNetworkAttachment(getBareMetalServerNetworkAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke AddBareMetalServerNetworkInterfaceFloatingIP with error: Operation validation and request error`, func() { + It(`Invoke GetBareMetalServerNetworkAttachment with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -47262,24 +48004,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the AddBareMetalServerNetworkInterfaceFloatingIPOptions model - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddBareMetalServerNetworkInterfaceFloatingIPOptions) - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBareMetalServerNetworkAttachmentOptions model + getBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.GetBareMetalServerNetworkAttachmentOptions) + getBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerNetworkAttachmentOptionsModel.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.AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr := vpcService.GetBareMetalServerNetworkAttachment(getBareMetalServerNetworkAttachmentOptionsModel) 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 AddBareMetalServerNetworkInterfaceFloatingIPOptions model with no property values - addBareMetalServerNetworkInterfaceFloatingIPOptionsModelNew := new(vpcv1.AddBareMetalServerNetworkInterfaceFloatingIPOptions) + // Construct a second instance of the GetBareMetalServerNetworkAttachmentOptions model with no property values + getBareMetalServerNetworkAttachmentOptionsModelNew := new(vpcv1.GetBareMetalServerNetworkAttachmentOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptionsModelNew) + result, response, operationErr = vpcService.GetBareMetalServerNetworkAttachment(getBareMetalServerNetworkAttachmentOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -47294,10 +48035,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke AddBareMetalServerNetworkInterfaceFloatingIP successfully`, func() { + It(`Invoke GetBareMetalServerNetworkAttachment successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -47306,15 +48047,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the AddBareMetalServerNetworkInterfaceFloatingIPOptions model - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddBareMetalServerNetworkInterfaceFloatingIPOptions) - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBareMetalServerNetworkAttachmentOptions model + getBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.GetBareMetalServerNetworkAttachmentOptions) + getBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptionsModel) + result, response, operationErr := vpcService.GetBareMetalServerNetworkAttachment(getBareMetalServerNetworkAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -47326,17 +48066,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions) - Operation response error`, func() { + Describe(`UpdateBareMetalServerNetworkAttachment(updateBareMetalServerNetworkAttachmentOptions *UpdateBareMetalServerNetworkAttachmentOptions) - Operation response error`, func() { version := "testString" - listBareMetalServerNetworkInterfaceIpsPath := "/bare_metal_servers/testString/network_interfaces/testString/ips" + updateBareMetalServerNetworkAttachmentPath := "/bare_metal_servers/testString/network_attachments/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(listBareMetalServerNetworkInterfaceIpsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateBareMetalServerNetworkAttachmentPath)) + 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") @@ -47344,7 +48084,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListBareMetalServerNetworkInterfaceIps with error: Operation response processing error`, func() { + It(`Invoke UpdateBareMetalServerNetworkAttachment with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -47353,20 +48093,28 @@ var _ = Describe(`VpcV1`, func() { 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"} + // Construct an instance of the BareMetalServerNetworkAttachmentPatch model + bareMetalServerNetworkAttachmentPatchModel := new(vpcv1.BareMetalServerNetworkAttachmentPatch) + bareMetalServerNetworkAttachmentPatchModel.AllowedVlans = []int64{int64(4)} + bareMetalServerNetworkAttachmentPatchModel.Name = core.StringPtr("my-bare-metal-server-network-attachment-updated") + bareMetalServerNetworkAttachmentPatchModelAsPatch, asPatchErr := bareMetalServerNetworkAttachmentPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateBareMetalServerNetworkAttachmentOptions model + updateBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.UpdateBareMetalServerNetworkAttachmentOptions) + updateBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") + updateBareMetalServerNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + updateBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerNetworkAttachmentPatch = bareMetalServerNetworkAttachmentPatchModelAsPatch + updateBareMetalServerNetworkAttachmentOptionsModel.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) + result, response, operationErr := vpcService.UpdateBareMetalServerNetworkAttachment(updateBareMetalServerNetworkAttachmentOptionsModel) 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) + result, response, operationErr = vpcService.UpdateBareMetalServerNetworkAttachment(updateBareMetalServerNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -47376,17 +48124,33 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions)`, func() { + Describe(`UpdateBareMetalServerNetworkAttachment(updateBareMetalServerNetworkAttachmentOptions *UpdateBareMetalServerNetworkAttachmentOptions)`, func() { version := "testString" - listBareMetalServerNetworkInterfaceIpsPath := "/bare_metal_servers/testString/network_interfaces/testString/ips" + updateBareMetalServerNetworkAttachmentPath := "/bare_metal_servers/testString/network_attachments/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(listBareMetalServerNetworkInterfaceIpsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateBareMetalServerNetworkAttachmentPath)) + 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))})) @@ -47396,10 +48160,10 @@ 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/bare_metal_servers/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:r134-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/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-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/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e/ips?start=a404e343444b4e1095c9edba76672d67&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "lifecycle_state": "stable", "name": "my-bare-metal-server-network-attachment", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"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"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "allowed_vlans": [4], "interface_type": "pci"}`) })) }) - It(`Invoke ListBareMetalServerNetworkInterfaceIps successfully with retries`, func() { + It(`Invoke UpdateBareMetalServerNetworkAttachment successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -47409,22 +48173,30 @@ var _ = Describe(`VpcV1`, func() { 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"} + // Construct an instance of the BareMetalServerNetworkAttachmentPatch model + bareMetalServerNetworkAttachmentPatchModel := new(vpcv1.BareMetalServerNetworkAttachmentPatch) + bareMetalServerNetworkAttachmentPatchModel.AllowedVlans = []int64{int64(4)} + bareMetalServerNetworkAttachmentPatchModel.Name = core.StringPtr("my-bare-metal-server-network-attachment-updated") + bareMetalServerNetworkAttachmentPatchModelAsPatch, asPatchErr := bareMetalServerNetworkAttachmentPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateBareMetalServerNetworkAttachmentOptions model + updateBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.UpdateBareMetalServerNetworkAttachmentOptions) + updateBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") + updateBareMetalServerNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + updateBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerNetworkAttachmentPatch = bareMetalServerNetworkAttachmentPatchModelAsPatch + updateBareMetalServerNetworkAttachmentOptionsModel.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) + _, _, operationErr := vpcService.UpdateBareMetalServerNetworkAttachmentWithContext(ctx, updateBareMetalServerNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptionsModel) + result, response, operationErr := vpcService.UpdateBareMetalServerNetworkAttachment(updateBareMetalServerNetworkAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -47432,7 +48204,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListBareMetalServerNetworkInterfaceIpsWithContext(ctx, listBareMetalServerNetworkInterfaceIpsOptionsModel) + _, _, operationErr = vpcService.UpdateBareMetalServerNetworkAttachmentWithContext(ctx, updateBareMetalServerNetworkAttachmentOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -47446,18 +48218,34 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerNetworkInterfaceIpsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateBareMetalServerNetworkAttachmentPath)) + 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", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/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:r134-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/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-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/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e/ips?start=a404e343444b4e1095c9edba76672d67&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "lifecycle_state": "stable", "name": "my-bare-metal-server-network-attachment", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"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"}, "type": "primary", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "allowed_vlans": [4], "interface_type": "pci"}`) })) }) - It(`Invoke ListBareMetalServerNetworkInterfaceIps successfully`, func() { + It(`Invoke UpdateBareMetalServerNetworkAttachment successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -47467,25 +48255,33 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaceIps(nil) + result, response, operationErr := vpcService.UpdateBareMetalServerNetworkAttachment(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"} + // Construct an instance of the BareMetalServerNetworkAttachmentPatch model + bareMetalServerNetworkAttachmentPatchModel := new(vpcv1.BareMetalServerNetworkAttachmentPatch) + bareMetalServerNetworkAttachmentPatchModel.AllowedVlans = []int64{int64(4)} + bareMetalServerNetworkAttachmentPatchModel.Name = core.StringPtr("my-bare-metal-server-network-attachment-updated") + bareMetalServerNetworkAttachmentPatchModelAsPatch, asPatchErr := bareMetalServerNetworkAttachmentPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateBareMetalServerNetworkAttachmentOptions model + updateBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.UpdateBareMetalServerNetworkAttachmentOptions) + updateBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") + updateBareMetalServerNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + updateBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerNetworkAttachmentPatch = bareMetalServerNetworkAttachmentPatchModelAsPatch + updateBareMetalServerNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptionsModel) + result, response, operationErr = vpcService.UpdateBareMetalServerNetworkAttachment(updateBareMetalServerNetworkAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListBareMetalServerNetworkInterfaceIps with error: Operation validation and request error`, func() { + It(`Invoke UpdateBareMetalServerNetworkAttachment with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -47494,23 +48290,31 @@ var _ = Describe(`VpcV1`, func() { 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"} + // Construct an instance of the BareMetalServerNetworkAttachmentPatch model + bareMetalServerNetworkAttachmentPatchModel := new(vpcv1.BareMetalServerNetworkAttachmentPatch) + bareMetalServerNetworkAttachmentPatchModel.AllowedVlans = []int64{int64(4)} + bareMetalServerNetworkAttachmentPatchModel.Name = core.StringPtr("my-bare-metal-server-network-attachment-updated") + bareMetalServerNetworkAttachmentPatchModelAsPatch, asPatchErr := bareMetalServerNetworkAttachmentPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateBareMetalServerNetworkAttachmentOptions model + updateBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.UpdateBareMetalServerNetworkAttachmentOptions) + updateBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") + updateBareMetalServerNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + updateBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerNetworkAttachmentPatch = bareMetalServerNetworkAttachmentPatchModelAsPatch + updateBareMetalServerNetworkAttachmentOptionsModel.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) + result, response, operationErr := vpcService.UpdateBareMetalServerNetworkAttachment(updateBareMetalServerNetworkAttachmentOptionsModel) 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) + // Construct a second instance of the UpdateBareMetalServerNetworkAttachmentOptions model with no property values + updateBareMetalServerNetworkAttachmentOptionsModelNew := new(vpcv1.UpdateBareMetalServerNetworkAttachmentOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptionsModelNew) + result, response, operationErr = vpcService.UpdateBareMetalServerNetworkAttachment(updateBareMetalServerNetworkAttachmentOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -47528,7 +48332,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListBareMetalServerNetworkInterfaceIps successfully`, func() { + It(`Invoke UpdateBareMetalServerNetworkAttachment successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -47537,14 +48341,22 @@ var _ = Describe(`VpcV1`, func() { 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"} + // Construct an instance of the BareMetalServerNetworkAttachmentPatch model + bareMetalServerNetworkAttachmentPatchModel := new(vpcv1.BareMetalServerNetworkAttachmentPatch) + bareMetalServerNetworkAttachmentPatchModel.AllowedVlans = []int64{int64(4)} + bareMetalServerNetworkAttachmentPatchModel.Name = core.StringPtr("my-bare-metal-server-network-attachment-updated") + bareMetalServerNetworkAttachmentPatchModelAsPatch, asPatchErr := bareMetalServerNetworkAttachmentPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateBareMetalServerNetworkAttachmentOptions model + updateBareMetalServerNetworkAttachmentOptionsModel := new(vpcv1.UpdateBareMetalServerNetworkAttachmentOptions) + updateBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID = core.StringPtr("testString") + updateBareMetalServerNetworkAttachmentOptionsModel.ID = core.StringPtr("testString") + updateBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerNetworkAttachmentPatch = bareMetalServerNetworkAttachmentPatchModelAsPatch + updateBareMetalServerNetworkAttachmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptionsModel) + result, response, operationErr := vpcService.UpdateBareMetalServerNetworkAttachment(updateBareMetalServerNetworkAttachmentOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -47556,25 +48368,27 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) - Operation response error`, func() { + Describe(`ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) - Operation response error`, func() { version := "testString" - getBareMetalServerNetworkInterfaceIPPath := "/bare_metal_servers/testString/network_interfaces/testString/ips/testString" + listBareMetalServerNetworkInterfacesPath := "/bare_metal_servers/testString/network_interfaces" 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.URL.EscapedPath()).To(Equal(listBareMetalServerNetworkInterfacesPath)) 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(10))})) 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() { + It(`Invoke ListBareMetalServerNetworkInterfaces with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -47583,21 +48397,21 @@ var _ = Describe(`VpcV1`, func() { 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"} + // Construct an instance of the ListBareMetalServerNetworkInterfacesOptions model + listBareMetalServerNetworkInterfacesOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfacesOptions) + listBareMetalServerNetworkInterfacesOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") + listBareMetalServerNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBareMetalServerNetworkInterfacesOptionsModel.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) + result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptionsModel) 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) + result, response, operationErr = vpcService.ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -47607,30 +48421,32 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions)`, func() { + Describe(`ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions)`, func() { version := "testString" - getBareMetalServerNetworkInterfaceIPPath := "/bare_metal_servers/testString/network_interfaces/testString/ips/testString" + listBareMetalServerNetworkInterfacesPath := "/bare_metal_servers/testString/network_interfaces" 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.URL.EscapedPath()).To(Equal(listBareMetalServerNetworkInterfacesPath)) 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(10))})) // 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:r134-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/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/3b2669a2-4c2b-4003-bc91-1b81f1326267/network_interfaces?limit=20"}, "limit": 20, "network_interfaces": [{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-network-interface", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "network_interface", "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"}], "status": "available", "subnet": {"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"}, "type": "primary", "interface_type": "hipersocket"}], "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/3b2669a2-4c2b-4003-bc91-1b81f1326267/network_interfaces?start=d3e721fd-c988-4670-9927-dbd5e7b07fc6&limit=20"}, "total_count": 132}`) })) }) - It(`Invoke GetBareMetalServerNetworkInterfaceIP successfully with retries`, func() { + It(`Invoke ListBareMetalServerNetworkInterfaces successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -47640,23 +48456,23 @@ var _ = Describe(`VpcV1`, func() { 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"} + // Construct an instance of the ListBareMetalServerNetworkInterfacesOptions model + listBareMetalServerNetworkInterfacesOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfacesOptions) + listBareMetalServerNetworkInterfacesOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") + listBareMetalServerNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBareMetalServerNetworkInterfacesOptionsModel.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) + _, _, operationErr := vpcService.ListBareMetalServerNetworkInterfacesWithContext(ctx, listBareMetalServerNetworkInterfacesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptionsModel) + result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -47664,7 +48480,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetBareMetalServerNetworkInterfaceIPWithContext(ctx, getBareMetalServerNetworkInterfaceIPOptionsModel) + _, _, operationErr = vpcService.ListBareMetalServerNetworkInterfacesWithContext(ctx, listBareMetalServerNetworkInterfacesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -47678,18 +48494,20 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerNetworkInterfaceIPPath)) + Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerNetworkInterfacesPath)) 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(10))})) // 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:r134-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/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/3b2669a2-4c2b-4003-bc91-1b81f1326267/network_interfaces?limit=20"}, "limit": 20, "network_interfaces": [{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-network-interface", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "network_interface", "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"}], "status": "available", "subnet": {"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"}, "type": "primary", "interface_type": "hipersocket"}], "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/3b2669a2-4c2b-4003-bc91-1b81f1326267/network_interfaces?start=d3e721fd-c988-4670-9927-dbd5e7b07fc6&limit=20"}, "total_count": 132}`) })) }) - It(`Invoke GetBareMetalServerNetworkInterfaceIP successfully`, func() { + It(`Invoke ListBareMetalServerNetworkInterfaces successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -47699,26 +48517,26 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetBareMetalServerNetworkInterfaceIP(nil) + result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaces(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"} + // Construct an instance of the ListBareMetalServerNetworkInterfacesOptions model + listBareMetalServerNetworkInterfacesOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfacesOptions) + listBareMetalServerNetworkInterfacesOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") + listBareMetalServerNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBareMetalServerNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptionsModel) + result, response, operationErr = vpcService.ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetBareMetalServerNetworkInterfaceIP with error: Operation validation and request error`, func() { + It(`Invoke ListBareMetalServerNetworkInterfaces with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -47727,24 +48545,24 @@ var _ = Describe(`VpcV1`, func() { 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"} + // Construct an instance of the ListBareMetalServerNetworkInterfacesOptions model + listBareMetalServerNetworkInterfacesOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfacesOptions) + listBareMetalServerNetworkInterfacesOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") + listBareMetalServerNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBareMetalServerNetworkInterfacesOptionsModel.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) + result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptionsModel) 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) + // Construct a second instance of the ListBareMetalServerNetworkInterfacesOptions model with no property values + listBareMetalServerNetworkInterfacesOptionsModelNew := new(vpcv1.ListBareMetalServerNetworkInterfacesOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptionsModelNew) + result, response, operationErr = vpcService.ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -47762,7 +48580,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetBareMetalServerNetworkInterfaceIP successfully`, func() { + It(`Invoke ListBareMetalServerNetworkInterfaces successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -47771,15 +48589,15 @@ var _ = Describe(`VpcV1`, func() { 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"} + // Construct an instance of the ListBareMetalServerNetworkInterfacesOptions model + listBareMetalServerNetworkInterfacesOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfacesOptions) + listBareMetalServerNetworkInterfacesOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") + listBareMetalServerNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listBareMetalServerNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptionsModel) + result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -47790,25 +48608,59 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) - }) - Describe(`DeleteBareMetalServer(deleteBareMetalServerOptions *DeleteBareMetalServerOptions)`, func() { - version := "testString" - deleteBareMetalServerPath := "/bare_metal_servers/testString" - Context(`Using mock server endpoint`, func() { + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(vpcv1.BareMetalServerNetworkInterfaceCollection) + nextObject := new(vpcv1.BareMetalServerNetworkInterfaceCollectionNext) + 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.BareMetalServerNetworkInterfaceCollection) + + 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.BareMetalServerNetworkInterfaceCollection) + nextObject := new(vpcv1.BareMetalServerNetworkInterfaceCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { BeforeEach(func() { + var requestNumber int = 0 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(deleteBareMetalServerPath)) - Expect(req.Method).To(Equal("DELETE")) + Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerNetworkInterfacesPath)) + 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.WriteHeader(202) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"network_interfaces":[{"allow_ip_spoofing":true,"created_at":"2019-01-01T12:00:00.000Z","enable_infrastructure_nat":true,"floating_ips":[{"address":"203.0.113.1","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689","id":"39300233-9995-4806-89a5-3c1b6eb88689","name":"my-floating-ip"}],"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","mac_address":"02:00:04:00:C4:6A","name":"my-bare-metal-server-network-interface","port_speed":1000,"primary_ip":{"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"},"resource_type":"network_interface","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"}],"status":"available","subnet":{"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"},"type":"primary","interface_type":"hipersocket"}]}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"network_interfaces":[{"allow_ip_spoofing":true,"created_at":"2019-01-01T12:00:00.000Z","enable_infrastructure_nat":true,"floating_ips":[{"address":"203.0.113.1","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689","id":"39300233-9995-4806-89a5-3c1b6eb88689","name":"my-floating-ip"}],"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","mac_address":"02:00:04:00:C4:6A","name":"my-bare-metal-server-network-interface","port_speed":1000,"primary_ip":{"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"},"resource_type":"network_interface","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"}],"status":"available","subnet":{"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"},"type":"primary","interface_type":"hipersocket"}]}`) + } else { + res.WriteHeader(400) + } })) }) - It(`Invoke DeleteBareMetalServer successfully`, func() { + It(`Use BareMetalServerNetworkInterfacesPager.GetNext successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -47817,22 +48669,25 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.DeleteBareMetalServer(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) + listBareMetalServerNetworkInterfacesOptionsModel := &vpcv1.ListBareMetalServerNetworkInterfacesOptions{ + BareMetalServerID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + } - // Construct an instance of the DeleteBareMetalServerOptions model - deleteBareMetalServerOptionsModel := new(vpcv1.DeleteBareMetalServerOptions) - deleteBareMetalServerOptionsModel.ID = core.StringPtr("testString") - deleteBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + pager, err := vpcService.NewBareMetalServerNetworkInterfacesPager(listBareMetalServerNetworkInterfacesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteBareMetalServer(deleteBareMetalServerOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) + var allResults []vpcv1.BareMetalServerNetworkInterfaceIntf + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) }) - It(`Invoke DeleteBareMetalServer with error: Operation validation and request error`, func() { + It(`Use BareMetalServerNetworkInterfacesPager.GetAll successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -47841,48 +48696,41 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteBareMetalServerOptions model - deleteBareMetalServerOptionsModel := new(vpcv1.DeleteBareMetalServerOptions) - deleteBareMetalServerOptionsModel.ID = core.StringPtr("testString") - deleteBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := vpcService.SetServiceURL("") + listBareMetalServerNetworkInterfacesOptionsModel := &vpcv1.ListBareMetalServerNetworkInterfacesOptions{ + BareMetalServerID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewBareMetalServerNetworkInterfacesPager(listBareMetalServerNetworkInterfacesOptionsModel) Expect(err).To(BeNil()) - response, operationErr := vpcService.DeleteBareMetalServer(deleteBareMetalServerOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteBareMetalServerOptions model with no property values - deleteBareMetalServerOptionsModelNew := new(vpcv1.DeleteBareMetalServerOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteBareMetalServer(deleteBareMetalServerOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) }) }) }) - Describe(`GetBareMetalServer(getBareMetalServerOptions *GetBareMetalServerOptions) - Operation response error`, func() { + Describe(`CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions) - Operation response error`, func() { version := "testString" - getBareMetalServerPath := "/bare_metal_servers/testString" + createBareMetalServerNetworkInterfacePath := "/bare_metal_servers/testString/network_interfaces" 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(getBareMetalServerPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createBareMetalServerNetworkInterfacePath)) + 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(200) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetBareMetalServer with error: Operation response processing error`, func() { + It(`Invoke CreateBareMetalServerNetworkInterface with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -47891,19 +48739,44 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBareMetalServerOptions model - getBareMetalServerOptionsModel := new(vpcv1.GetBareMetalServerOptions) - getBareMetalServerOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model + networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) + networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // 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 SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype model + bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) + bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkInterfacePrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-interface") + bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel + bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") + + // Construct an instance of the CreateBareMetalServerNetworkInterfaceOptions model + createBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.CreateBareMetalServerNetworkInterfaceOptions) + createBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") + createBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePrototype = bareMetalServerNetworkInterfacePrototypeModel + createBareMetalServerNetworkInterfaceOptionsModel.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.GetBareMetalServer(getBareMetalServerOptionsModel) + result, response, operationErr := vpcService.CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptionsModel) 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.GetBareMetalServer(getBareMetalServerOptionsModel) + result, response, operationErr = vpcService.CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -47913,17 +48786,33 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetBareMetalServer(getBareMetalServerOptions *GetBareMetalServerOptions)`, func() { + Describe(`CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions)`, func() { version := "testString" - getBareMetalServerPath := "/bare_metal_servers/testString" + createBareMetalServerNetworkInterfacePath := "/bare_metal_servers/testString/network_interfaces" 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(getBareMetalServerPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createBareMetalServerNetworkInterfacePath)) + 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))})) @@ -47932,11 +48821,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "name": "my-bare-metal-server", "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}], "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "deleting", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "disabled", "supported_modes": ["disabled"]}, "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"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-network-interface", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "network_interface", "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"}], "status": "available", "subnet": {"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"}, "type": "primary", "interface_type": "hipersocket"}`) })) }) - It(`Invoke GetBareMetalServer successfully with retries`, func() { + It(`Invoke CreateBareMetalServerNetworkInterface successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -47946,21 +48835,46 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetBareMetalServerOptions model - getBareMetalServerOptionsModel := new(vpcv1.GetBareMetalServerOptions) - getBareMetalServerOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model + networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) + networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // 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 SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype model + bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) + bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkInterfacePrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-interface") + bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel + bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") + + // Construct an instance of the CreateBareMetalServerNetworkInterfaceOptions model + createBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.CreateBareMetalServerNetworkInterfaceOptions) + createBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") + createBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePrototype = bareMetalServerNetworkInterfacePrototypeModel + createBareMetalServerNetworkInterfaceOptionsModel.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.GetBareMetalServerWithContext(ctx, getBareMetalServerOptionsModel) + _, _, operationErr := vpcService.CreateBareMetalServerNetworkInterfaceWithContext(ctx, createBareMetalServerNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetBareMetalServer(getBareMetalServerOptionsModel) + result, response, operationErr := vpcService.CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -47968,7 +48882,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetBareMetalServerWithContext(ctx, getBareMetalServerOptionsModel) + _, _, operationErr = vpcService.CreateBareMetalServerNetworkInterfaceWithContext(ctx, createBareMetalServerNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -47982,18 +48896,34 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createBareMetalServerNetworkInterfacePath)) + 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(200) - fmt.Fprintf(res, "%s", `{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "name": "my-bare-metal-server", "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}], "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "deleting", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "disabled", "supported_modes": ["disabled"]}, "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"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-network-interface", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "network_interface", "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"}], "status": "available", "subnet": {"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"}, "type": "primary", "interface_type": "hipersocket"}`) })) }) - It(`Invoke GetBareMetalServer successfully`, func() { + It(`Invoke CreateBareMetalServerNetworkInterface successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -48003,24 +48933,49 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetBareMetalServer(nil) + result, response, operationErr := vpcService.CreateBareMetalServerNetworkInterface(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetBareMetalServerOptions model - getBareMetalServerOptionsModel := new(vpcv1.GetBareMetalServerOptions) - getBareMetalServerOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model + networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) + networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // 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 SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype model + bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) + bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkInterfacePrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-interface") + bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel + bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") + + // Construct an instance of the CreateBareMetalServerNetworkInterfaceOptions model + createBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.CreateBareMetalServerNetworkInterfaceOptions) + createBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") + createBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePrototype = bareMetalServerNetworkInterfacePrototypeModel + createBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetBareMetalServer(getBareMetalServerOptionsModel) + result, response, operationErr = vpcService.CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetBareMetalServer with error: Operation validation and request error`, func() { + It(`Invoke CreateBareMetalServerNetworkInterface with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -48029,22 +48984,47 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBareMetalServerOptions model - getBareMetalServerOptionsModel := new(vpcv1.GetBareMetalServerOptions) - getBareMetalServerOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model + networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) + networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // 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 SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype model + bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) + bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkInterfacePrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-interface") + bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel + bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") + + // Construct an instance of the CreateBareMetalServerNetworkInterfaceOptions model + createBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.CreateBareMetalServerNetworkInterfaceOptions) + createBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") + createBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePrototype = bareMetalServerNetworkInterfacePrototypeModel + createBareMetalServerNetworkInterfaceOptionsModel.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.GetBareMetalServer(getBareMetalServerOptionsModel) + result, response, operationErr := vpcService.CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptionsModel) 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 GetBareMetalServerOptions model with no property values - getBareMetalServerOptionsModelNew := new(vpcv1.GetBareMetalServerOptions) + // Construct a second instance of the CreateBareMetalServerNetworkInterfaceOptions model with no property values + createBareMetalServerNetworkInterfaceOptionsModelNew := new(vpcv1.CreateBareMetalServerNetworkInterfaceOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetBareMetalServer(getBareMetalServerOptionsModelNew) + result, response, operationErr = vpcService.CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -48059,10 +49039,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke GetBareMetalServer successfully`, func() { + It(`Invoke CreateBareMetalServerNetworkInterface successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -48071,13 +49051,38 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBareMetalServerOptions model - getBareMetalServerOptionsModel := new(vpcv1.GetBareMetalServerOptions) - getBareMetalServerOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model + networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) + networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // 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 SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype model + bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) + bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkInterfacePrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-interface") + bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel + bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") + + // Construct an instance of the CreateBareMetalServerNetworkInterfaceOptions model + createBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.CreateBareMetalServerNetworkInterfaceOptions) + createBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") + createBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePrototype = bareMetalServerNetworkInterfacePrototypeModel + createBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetBareMetalServer(getBareMetalServerOptionsModel) + result, response, operationErr := vpcService.CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -48089,17 +49094,92 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateBareMetalServer(updateBareMetalServerOptions *UpdateBareMetalServerOptions) - Operation response error`, func() { + Describe(`DeleteBareMetalServerNetworkInterface(deleteBareMetalServerNetworkInterfaceOptions *DeleteBareMetalServerNetworkInterfaceOptions)`, func() { version := "testString" - updateBareMetalServerPath := "/bare_metal_servers/testString" + deleteBareMetalServerNetworkInterfacePath := "/bare_metal_servers/testString/network_interfaces/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(deleteBareMetalServerNetworkInterfacePath)) + 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(204) + })) + }) + It(`Invoke DeleteBareMetalServerNetworkInterface 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.DeleteBareMetalServerNetworkInterface(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteBareMetalServerNetworkInterfaceOptions model + deleteBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.DeleteBareMetalServerNetworkInterfaceOptions) + deleteBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") + deleteBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + deleteBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteBareMetalServerNetworkInterface(deleteBareMetalServerNetworkInterfaceOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteBareMetalServerNetworkInterface 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 DeleteBareMetalServerNetworkInterfaceOptions model + deleteBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.DeleteBareMetalServerNetworkInterfaceOptions) + deleteBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") + deleteBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + deleteBareMetalServerNetworkInterfaceOptionsModel.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.DeleteBareMetalServerNetworkInterface(deleteBareMetalServerNetworkInterfaceOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteBareMetalServerNetworkInterfaceOptions model with no property values + deleteBareMetalServerNetworkInterfaceOptionsModelNew := new(vpcv1.DeleteBareMetalServerNetworkInterfaceOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteBareMetalServerNetworkInterface(deleteBareMetalServerNetworkInterfaceOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions) - Operation response error`, func() { + version := "testString" + getBareMetalServerNetworkInterfacePath := "/bare_metal_servers/testString/network_interfaces/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(updateBareMetalServerPath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerNetworkInterfacePath)) + 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") @@ -48107,7 +49187,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateBareMetalServer with error: Operation response processing error`, func() { + It(`Invoke GetBareMetalServerNetworkInterface with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -48116,32 +49196,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the BareMetalServerTrustedPlatformModulePatch model - bareMetalServerTrustedPlatformModulePatchModel := new(vpcv1.BareMetalServerTrustedPlatformModulePatch) - bareMetalServerTrustedPlatformModulePatchModel.Mode = core.StringPtr("disabled") - - // Construct an instance of the BareMetalServerPatch model - bareMetalServerPatchModel := new(vpcv1.BareMetalServerPatch) - bareMetalServerPatchModel.EnableSecureBoot = core.BoolPtr(false) - bareMetalServerPatchModel.Name = core.StringPtr("my-bare-metal-server") - bareMetalServerPatchModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePatchModel - bareMetalServerPatchModelAsPatch, asPatchErr := bareMetalServerPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateBareMetalServerOptions model - updateBareMetalServerOptionsModel := new(vpcv1.UpdateBareMetalServerOptions) - updateBareMetalServerOptionsModel.ID = core.StringPtr("testString") - updateBareMetalServerOptionsModel.BareMetalServerPatch = bareMetalServerPatchModelAsPatch - updateBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBareMetalServerNetworkInterfaceOptions model + getBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceOptions) + getBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceOptionsModel.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.UpdateBareMetalServer(updateBareMetalServerOptionsModel) + result, response, operationErr := vpcService.GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptionsModel) 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.UpdateBareMetalServer(updateBareMetalServerOptionsModel) + result, response, operationErr = vpcService.GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -48151,33 +49219,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateBareMetalServer(updateBareMetalServerOptions *UpdateBareMetalServerOptions)`, func() { + Describe(`GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions)`, func() { version := "testString" - updateBareMetalServerPath := "/bare_metal_servers/testString" + getBareMetalServerNetworkInterfacePath := "/bare_metal_servers/testString/network_interfaces/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(updateBareMetalServerPath)) - 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.EscapedPath()).To(Equal(getBareMetalServerNetworkInterfacePath)) + 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))})) @@ -48187,10 +49239,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "name": "my-bare-metal-server", "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}], "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "deleting", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "disabled", "supported_modes": ["disabled"]}, "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"}, "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", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-network-interface", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "network_interface", "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"}], "status": "available", "subnet": {"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"}, "type": "primary", "interface_type": "hipersocket"}`) })) }) - It(`Invoke UpdateBareMetalServer successfully with retries`, func() { + It(`Invoke GetBareMetalServerNetworkInterface successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -48200,34 +49252,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the BareMetalServerTrustedPlatformModulePatch model - bareMetalServerTrustedPlatformModulePatchModel := new(vpcv1.BareMetalServerTrustedPlatformModulePatch) - bareMetalServerTrustedPlatformModulePatchModel.Mode = core.StringPtr("disabled") - - // Construct an instance of the BareMetalServerPatch model - bareMetalServerPatchModel := new(vpcv1.BareMetalServerPatch) - bareMetalServerPatchModel.EnableSecureBoot = core.BoolPtr(false) - bareMetalServerPatchModel.Name = core.StringPtr("my-bare-metal-server") - bareMetalServerPatchModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePatchModel - bareMetalServerPatchModelAsPatch, asPatchErr := bareMetalServerPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateBareMetalServerOptions model - updateBareMetalServerOptionsModel := new(vpcv1.UpdateBareMetalServerOptions) - updateBareMetalServerOptionsModel.ID = core.StringPtr("testString") - updateBareMetalServerOptionsModel.BareMetalServerPatch = bareMetalServerPatchModelAsPatch - updateBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBareMetalServerNetworkInterfaceOptions model + getBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceOptions) + getBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceOptionsModel.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.UpdateBareMetalServerWithContext(ctx, updateBareMetalServerOptionsModel) + _, _, operationErr := vpcService.GetBareMetalServerNetworkInterfaceWithContext(ctx, getBareMetalServerNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateBareMetalServer(updateBareMetalServerOptionsModel) + result, response, operationErr := vpcService.GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -48235,7 +49275,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateBareMetalServerWithContext(ctx, updateBareMetalServerOptionsModel) + _, _, operationErr = vpcService.GetBareMetalServerNetworkInterfaceWithContext(ctx, getBareMetalServerNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -48249,34 +49289,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateBareMetalServerPath)) - 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.EscapedPath()).To(Equal(getBareMetalServerNetworkInterfacePath)) + 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", `{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "name": "my-bare-metal-server", "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}], "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "deleting", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "disabled", "supported_modes": ["disabled"]}, "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"}, "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", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-network-interface", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "network_interface", "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"}], "status": "available", "subnet": {"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"}, "type": "primary", "interface_type": "hipersocket"}`) })) }) - It(`Invoke UpdateBareMetalServer successfully`, func() { + It(`Invoke GetBareMetalServerNetworkInterface successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -48286,37 +49310,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateBareMetalServer(nil) + result, response, operationErr := vpcService.GetBareMetalServerNetworkInterface(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the BareMetalServerTrustedPlatformModulePatch model - bareMetalServerTrustedPlatformModulePatchModel := new(vpcv1.BareMetalServerTrustedPlatformModulePatch) - bareMetalServerTrustedPlatformModulePatchModel.Mode = core.StringPtr("disabled") - - // Construct an instance of the BareMetalServerPatch model - bareMetalServerPatchModel := new(vpcv1.BareMetalServerPatch) - bareMetalServerPatchModel.EnableSecureBoot = core.BoolPtr(false) - bareMetalServerPatchModel.Name = core.StringPtr("my-bare-metal-server") - bareMetalServerPatchModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePatchModel - bareMetalServerPatchModelAsPatch, asPatchErr := bareMetalServerPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateBareMetalServerOptions model - updateBareMetalServerOptionsModel := new(vpcv1.UpdateBareMetalServerOptions) - updateBareMetalServerOptionsModel.ID = core.StringPtr("testString") - updateBareMetalServerOptionsModel.BareMetalServerPatch = bareMetalServerPatchModelAsPatch - updateBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBareMetalServerNetworkInterfaceOptions model + getBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceOptions) + getBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateBareMetalServer(updateBareMetalServerOptionsModel) + result, response, operationErr = vpcService.GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateBareMetalServer with error: Operation validation and request error`, func() { + It(`Invoke GetBareMetalServerNetworkInterface with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -48325,35 +49337,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the BareMetalServerTrustedPlatformModulePatch model - bareMetalServerTrustedPlatformModulePatchModel := new(vpcv1.BareMetalServerTrustedPlatformModulePatch) - bareMetalServerTrustedPlatformModulePatchModel.Mode = core.StringPtr("disabled") - - // Construct an instance of the BareMetalServerPatch model - bareMetalServerPatchModel := new(vpcv1.BareMetalServerPatch) - bareMetalServerPatchModel.EnableSecureBoot = core.BoolPtr(false) - bareMetalServerPatchModel.Name = core.StringPtr("my-bare-metal-server") - bareMetalServerPatchModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePatchModel - bareMetalServerPatchModelAsPatch, asPatchErr := bareMetalServerPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateBareMetalServerOptions model - updateBareMetalServerOptionsModel := new(vpcv1.UpdateBareMetalServerOptions) - updateBareMetalServerOptionsModel.ID = core.StringPtr("testString") - updateBareMetalServerOptionsModel.BareMetalServerPatch = bareMetalServerPatchModelAsPatch - updateBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBareMetalServerNetworkInterfaceOptions model + getBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceOptions) + getBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceOptionsModel.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.UpdateBareMetalServer(updateBareMetalServerOptionsModel) + result, response, operationErr := vpcService.GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptionsModel) 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 UpdateBareMetalServerOptions model with no property values - updateBareMetalServerOptionsModelNew := new(vpcv1.UpdateBareMetalServerOptions) + // Construct a second instance of the GetBareMetalServerNetworkInterfaceOptions model with no property values + getBareMetalServerNetworkInterfaceOptionsModelNew := new(vpcv1.GetBareMetalServerNetworkInterfaceOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateBareMetalServer(updateBareMetalServerOptionsModelNew) + result, response, operationErr = vpcService.GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -48371,7 +49371,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateBareMetalServer successfully`, func() { + It(`Invoke GetBareMetalServerNetworkInterface successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -48380,26 +49380,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the BareMetalServerTrustedPlatformModulePatch model - bareMetalServerTrustedPlatformModulePatchModel := new(vpcv1.BareMetalServerTrustedPlatformModulePatch) - bareMetalServerTrustedPlatformModulePatchModel.Mode = core.StringPtr("disabled") - - // Construct an instance of the BareMetalServerPatch model - bareMetalServerPatchModel := new(vpcv1.BareMetalServerPatch) - bareMetalServerPatchModel.EnableSecureBoot = core.BoolPtr(false) - bareMetalServerPatchModel.Name = core.StringPtr("my-bare-metal-server") - bareMetalServerPatchModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePatchModel - bareMetalServerPatchModelAsPatch, asPatchErr := bareMetalServerPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateBareMetalServerOptions model - updateBareMetalServerOptionsModel := new(vpcv1.UpdateBareMetalServerOptions) - updateBareMetalServerOptionsModel.ID = core.StringPtr("testString") - updateBareMetalServerOptionsModel.BareMetalServerPatch = bareMetalServerPatchModelAsPatch - updateBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBareMetalServerNetworkInterfaceOptions model + getBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceOptions) + getBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.UpdateBareMetalServer(updateBareMetalServerOptionsModel) + result, response, operationErr := vpcService.GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -48411,17 +49399,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetBareMetalServerInitialization(getBareMetalServerInitializationOptions *GetBareMetalServerInitializationOptions) - Operation response error`, func() { + Describe(`UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions) - Operation response error`, func() { version := "testString" - getBareMetalServerInitializationPath := "/bare_metal_servers/testString/initialization" + updateBareMetalServerNetworkInterfacePath := "/bare_metal_servers/testString/network_interfaces/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(getBareMetalServerInitializationPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateBareMetalServerNetworkInterfacePath)) + 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") @@ -48429,7 +49417,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetBareMetalServerInitialization with error: Operation response processing error`, func() { + It(`Invoke UpdateBareMetalServerNetworkInterface with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -48438,19 +49426,30 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBareMetalServerInitializationOptions model - getBareMetalServerInitializationOptionsModel := new(vpcv1.GetBareMetalServerInitializationOptions) - getBareMetalServerInitializationOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerInitializationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the BareMetalServerNetworkInterfacePatch model + bareMetalServerNetworkInterfacePatchModel := new(vpcv1.BareMetalServerNetworkInterfacePatch) + bareMetalServerNetworkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkInterfacePatchModel.AllowedVlans = []int64{int64(4)} + bareMetalServerNetworkInterfacePatchModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkInterfacePatchModel.Name = core.StringPtr("my-bare-metal-server-network-interface") + bareMetalServerNetworkInterfacePatchModelAsPatch, asPatchErr := bareMetalServerNetworkInterfacePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateBareMetalServerNetworkInterfaceOptions model + updateBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.UpdateBareMetalServerNetworkInterfaceOptions) + updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") + updateBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePatch = bareMetalServerNetworkInterfacePatchModelAsPatch + updateBareMetalServerNetworkInterfaceOptionsModel.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.GetBareMetalServerInitialization(getBareMetalServerInitializationOptionsModel) + result, response, operationErr := vpcService.UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptionsModel) 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.GetBareMetalServerInitialization(getBareMetalServerInitializationOptionsModel) + result, response, operationErr = vpcService.UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -48460,17 +49459,33 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetBareMetalServerInitialization(getBareMetalServerInitializationOptions *GetBareMetalServerInitializationOptions)`, func() { + Describe(`UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions)`, func() { version := "testString" - getBareMetalServerInitializationPath := "/bare_metal_servers/testString/initialization" + updateBareMetalServerNetworkInterfacePath := "/bare_metal_servers/testString/network_interfaces/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(getBareMetalServerInitializationPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateBareMetalServerNetworkInterfacePath)) + 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))})) @@ -48480,10 +49495,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "keys": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/a6b1a881-2ce8-41a3-80fc-36316a73f803", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-key"}], "user_accounts": [{"encrypted_password": "qQ+/YEApnl1ZtEgIrfprzb065307thTkzlnLqL5ICpesdbBN03dyCQ==", "encryption_key": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/a6b1a881-2ce8-41a3-80fc-36316a73f803", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-key"}, "resource_type": "host_user_account", "username": "Administrator"}]}`) + fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-network-interface", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "network_interface", "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"}], "status": "available", "subnet": {"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"}, "type": "primary", "interface_type": "hipersocket"}`) })) }) - It(`Invoke GetBareMetalServerInitialization successfully with retries`, func() { + It(`Invoke UpdateBareMetalServerNetworkInterface successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -48493,21 +49508,32 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetBareMetalServerInitializationOptions model - getBareMetalServerInitializationOptionsModel := new(vpcv1.GetBareMetalServerInitializationOptions) - getBareMetalServerInitializationOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerInitializationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the BareMetalServerNetworkInterfacePatch model + bareMetalServerNetworkInterfacePatchModel := new(vpcv1.BareMetalServerNetworkInterfacePatch) + bareMetalServerNetworkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkInterfacePatchModel.AllowedVlans = []int64{int64(4)} + bareMetalServerNetworkInterfacePatchModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkInterfacePatchModel.Name = core.StringPtr("my-bare-metal-server-network-interface") + bareMetalServerNetworkInterfacePatchModelAsPatch, asPatchErr := bareMetalServerNetworkInterfacePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateBareMetalServerNetworkInterfaceOptions model + updateBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.UpdateBareMetalServerNetworkInterfaceOptions) + updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") + updateBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePatch = bareMetalServerNetworkInterfacePatchModelAsPatch + updateBareMetalServerNetworkInterfaceOptionsModel.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.GetBareMetalServerInitializationWithContext(ctx, getBareMetalServerInitializationOptionsModel) + _, _, operationErr := vpcService.UpdateBareMetalServerNetworkInterfaceWithContext(ctx, updateBareMetalServerNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetBareMetalServerInitialization(getBareMetalServerInitializationOptionsModel) + result, response, operationErr := vpcService.UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -48515,7 +49541,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetBareMetalServerInitializationWithContext(ctx, getBareMetalServerInitializationOptionsModel) + _, _, operationErr = vpcService.UpdateBareMetalServerNetworkInterfaceWithContext(ctx, updateBareMetalServerNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -48529,18 +49555,34 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerInitializationPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateBareMetalServerNetworkInterfacePath)) + 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", `{"image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "keys": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/a6b1a881-2ce8-41a3-80fc-36316a73f803", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-key"}], "user_accounts": [{"encrypted_password": "qQ+/YEApnl1ZtEgIrfprzb065307thTkzlnLqL5ICpesdbBN03dyCQ==", "encryption_key": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/a6b1a881-2ce8-41a3-80fc-36316a73f803", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-key"}, "resource_type": "host_user_account", "username": "Administrator"}]}`) + fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "created_at": "2019-01-01T12:00:00.000Z", "enable_infrastructure_nat": true, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "mac_address": "02:00:04:00:C4:6A", "name": "my-bare-metal-server-network-interface", "port_speed": 1000, "primary_ip": {"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"}, "resource_type": "network_interface", "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"}], "status": "available", "subnet": {"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"}, "type": "primary", "interface_type": "hipersocket"}`) })) }) - It(`Invoke GetBareMetalServerInitialization successfully`, func() { + It(`Invoke UpdateBareMetalServerNetworkInterface successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -48550,24 +49592,35 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetBareMetalServerInitialization(nil) + result, response, operationErr := vpcService.UpdateBareMetalServerNetworkInterface(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetBareMetalServerInitializationOptions model - getBareMetalServerInitializationOptionsModel := new(vpcv1.GetBareMetalServerInitializationOptions) - getBareMetalServerInitializationOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerInitializationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the BareMetalServerNetworkInterfacePatch model + bareMetalServerNetworkInterfacePatchModel := new(vpcv1.BareMetalServerNetworkInterfacePatch) + bareMetalServerNetworkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkInterfacePatchModel.AllowedVlans = []int64{int64(4)} + bareMetalServerNetworkInterfacePatchModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkInterfacePatchModel.Name = core.StringPtr("my-bare-metal-server-network-interface") + bareMetalServerNetworkInterfacePatchModelAsPatch, asPatchErr := bareMetalServerNetworkInterfacePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateBareMetalServerNetworkInterfaceOptions model + updateBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.UpdateBareMetalServerNetworkInterfaceOptions) + updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") + updateBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePatch = bareMetalServerNetworkInterfacePatchModelAsPatch + updateBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetBareMetalServerInitialization(getBareMetalServerInitializationOptionsModel) + result, response, operationErr = vpcService.UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetBareMetalServerInitialization with error: Operation validation and request error`, func() { + It(`Invoke UpdateBareMetalServerNetworkInterface with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -48576,22 +49629,33 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBareMetalServerInitializationOptions model - getBareMetalServerInitializationOptionsModel := new(vpcv1.GetBareMetalServerInitializationOptions) - getBareMetalServerInitializationOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerInitializationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the BareMetalServerNetworkInterfacePatch model + bareMetalServerNetworkInterfacePatchModel := new(vpcv1.BareMetalServerNetworkInterfacePatch) + bareMetalServerNetworkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkInterfacePatchModel.AllowedVlans = []int64{int64(4)} + bareMetalServerNetworkInterfacePatchModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkInterfacePatchModel.Name = core.StringPtr("my-bare-metal-server-network-interface") + bareMetalServerNetworkInterfacePatchModelAsPatch, asPatchErr := bareMetalServerNetworkInterfacePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateBareMetalServerNetworkInterfaceOptions model + updateBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.UpdateBareMetalServerNetworkInterfaceOptions) + updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") + updateBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePatch = bareMetalServerNetworkInterfacePatchModelAsPatch + updateBareMetalServerNetworkInterfaceOptionsModel.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.GetBareMetalServerInitialization(getBareMetalServerInitializationOptionsModel) + result, response, operationErr := vpcService.UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptionsModel) 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 GetBareMetalServerInitializationOptions model with no property values - getBareMetalServerInitializationOptionsModelNew := new(vpcv1.GetBareMetalServerInitializationOptions) + // Construct a second instance of the UpdateBareMetalServerNetworkInterfaceOptions model with no property values + updateBareMetalServerNetworkInterfaceOptionsModelNew := new(vpcv1.UpdateBareMetalServerNetworkInterfaceOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetBareMetalServerInitialization(getBareMetalServerInitializationOptionsModelNew) + result, response, operationErr = vpcService.UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -48609,7 +49673,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetBareMetalServerInitialization successfully`, func() { + It(`Invoke UpdateBareMetalServerNetworkInterface successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -48618,13 +49682,24 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetBareMetalServerInitializationOptions model - getBareMetalServerInitializationOptionsModel := new(vpcv1.GetBareMetalServerInitializationOptions) - getBareMetalServerInitializationOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerInitializationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the BareMetalServerNetworkInterfacePatch model + bareMetalServerNetworkInterfacePatchModel := new(vpcv1.BareMetalServerNetworkInterfacePatch) + bareMetalServerNetworkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkInterfacePatchModel.AllowedVlans = []int64{int64(4)} + bareMetalServerNetworkInterfacePatchModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkInterfacePatchModel.Name = core.StringPtr("my-bare-metal-server-network-interface") + bareMetalServerNetworkInterfacePatchModelAsPatch, asPatchErr := bareMetalServerNetworkInterfacePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateBareMetalServerNetworkInterfaceOptions model + updateBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.UpdateBareMetalServerNetworkInterfaceOptions) + updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID = core.StringPtr("testString") + updateBareMetalServerNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePatch = bareMetalServerNetworkInterfacePatchModelAsPatch + updateBareMetalServerNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetBareMetalServerInitialization(getBareMetalServerInitializationOptionsModel) + result, response, operationErr := vpcService.UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -48636,24 +49711,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`RestartBareMetalServer(restartBareMetalServerOptions *RestartBareMetalServerOptions)`, func() { + Describe(`ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) - Operation response error`, func() { version := "testString" - restartBareMetalServerPath := "/bare_metal_servers/testString/restart" - Context(`Using mock server endpoint`, func() { + listBareMetalServerNetworkInterfaceFloatingIpsPath := "/bare_metal_servers/testString/network_interfaces/testString/floating_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(restartBareMetalServerPath)) - Expect(req.Method).To(Equal("POST")) - + Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerNetworkInterfaceFloatingIpsPath)) + 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.WriteHeader(204) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke RestartBareMetalServer successfully`, func() { + It(`Invoke ListBareMetalServerNetworkInterfaceFloatingIps with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -48662,22 +49738,53 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.RestartBareMetalServer(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the RestartBareMetalServerOptions model - restartBareMetalServerOptionsModel := new(vpcv1.RestartBareMetalServerOptions) - restartBareMetalServerOptionsModel.ID = core.StringPtr("testString") - restartBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBareMetalServerNetworkInterfaceFloatingIpsOptions model + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfaceFloatingIpsOptions) + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.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.ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.RestartBareMetalServer(restartBareMetalServerOptionsModel) - Expect(operationErr).To(BeNil()) + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel) + Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) }) - It(`Invoke RestartBareMetalServer with error: Operation validation and request error`, func() { + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions)`, func() { + version := "testString" + listBareMetalServerNetworkInterfaceFloatingIpsPath := "/bare_metal_servers/testString/network_interfaces/testString/floating_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(listBareMetalServerNetworkInterfaceFloatingIpsPath)) + 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", `{"floating_ips": [{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}]}`) + })) + }) + It(`Invoke ListBareMetalServerNetworkInterfaceFloatingIps successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -48685,48 +49792,57 @@ var _ = Describe(`VpcV1`, func() { }) Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) - // Construct an instance of the RestartBareMetalServerOptions model - restartBareMetalServerOptionsModel := new(vpcv1.RestartBareMetalServerOptions) - restartBareMetalServerOptionsModel.ID = core.StringPtr("testString") - restartBareMetalServerOptionsModel.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.RestartBareMetalServer(restartBareMetalServerOptionsModel) + // Construct an instance of the ListBareMetalServerNetworkInterfaceFloatingIpsOptions model + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfaceFloatingIpsOptions) + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.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.ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(ctx, listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel) Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the RestartBareMetalServerOptions model with no property values - restartBareMetalServerOptionsModelNew := new(vpcv1.RestartBareMetalServerOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.RestartBareMetalServer(restartBareMetalServerOptionsModelNew) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel) + 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.ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(ctx, listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel) Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) AfterEach(func() { testServer.Close() }) }) - }) - Describe(`StartBareMetalServer(startBareMetalServerOptions *StartBareMetalServerOptions)`, func() { - version := "testString" - startBareMetalServerPath := "/bare_metal_servers/testString/start" 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(startBareMetalServerPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerNetworkInterfaceFloatingIpsPath)) + 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.WriteHeader(204) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"floating_ips": [{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}]}`) })) }) - It(`Invoke StartBareMetalServer successfully`, func() { + It(`Invoke ListBareMetalServerNetworkInterfaceFloatingIps successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -48736,21 +49852,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.StartBareMetalServer(nil) + result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaceFloatingIps(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) + Expect(result).To(BeNil()) - // Construct an instance of the StartBareMetalServerOptions model - startBareMetalServerOptionsModel := new(vpcv1.StartBareMetalServerOptions) - startBareMetalServerOptionsModel.ID = core.StringPtr("testString") - startBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBareMetalServerNetworkInterfaceFloatingIpsOptions model + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfaceFloatingIpsOptions) + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.StartBareMetalServer(startBareMetalServerOptionsModel) + result, response, operationErr = vpcService.ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + }) - It(`Invoke StartBareMetalServer with error: Operation validation and request error`, func() { + It(`Invoke ListBareMetalServerNetworkInterfaceFloatingIps with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -48759,63 +49879,86 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the StartBareMetalServerOptions model - startBareMetalServerOptionsModel := new(vpcv1.StartBareMetalServerOptions) - startBareMetalServerOptionsModel.ID = core.StringPtr("testString") - startBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListBareMetalServerNetworkInterfaceFloatingIpsOptions model + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfaceFloatingIpsOptions) + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.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.StartBareMetalServer(startBareMetalServerOptionsModel) + result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - // Construct a second instance of the StartBareMetalServerOptions model with no property values - startBareMetalServerOptionsModelNew := new(vpcv1.StartBareMetalServerOptions) + Expect(result).To(BeNil()) + // Construct a second instance of the ListBareMetalServerNetworkInterfaceFloatingIpsOptions model with no property values + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModelNew := new(vpcv1.ListBareMetalServerNetworkInterfaceFloatingIpsOptions) // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.StartBareMetalServer(startBareMetalServerOptionsModelNew) + result, response, operationErr = vpcService.ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptionsModelNew) 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 ListBareMetalServerNetworkInterfaceFloatingIps 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 ListBareMetalServerNetworkInterfaceFloatingIpsOptions model + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfaceFloatingIpsOptions) + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.BareMetalServerID = core.StringPtr("testString") + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`StopBareMetalServer(stopBareMetalServerOptions *StopBareMetalServerOptions)`, func() { + Describe(`RemoveBareMetalServerNetworkInterfaceFloatingIP(removeBareMetalServerNetworkInterfaceFloatingIPOptions *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions)`, func() { version := "testString" - stopBareMetalServerPath := "/bare_metal_servers/testString/stop" + removeBareMetalServerNetworkInterfaceFloatingIPPath := "/bare_metal_servers/testString/network_interfaces/testString/floating_ips/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(stopBareMetalServerPath)) - 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.EscapedPath()).To(Equal(removeBareMetalServerNetworkInterfaceFloatingIPPath)) + 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(204) })) }) - It(`Invoke StopBareMetalServer successfully`, func() { + It(`Invoke RemoveBareMetalServerNetworkInterfaceFloatingIP successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -48825,22 +49968,23 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.StopBareMetalServer(nil) + response, operationErr := vpcService.RemoveBareMetalServerNetworkInterfaceFloatingIP(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) - // Construct an instance of the StopBareMetalServerOptions model - stopBareMetalServerOptionsModel := new(vpcv1.StopBareMetalServerOptions) - stopBareMetalServerOptionsModel.ID = core.StringPtr("testString") - stopBareMetalServerOptionsModel.Type = core.StringPtr("hard") - stopBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RemoveBareMetalServerNetworkInterfaceFloatingIPOptions model + removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) + removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") + removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.StopBareMetalServer(stopBareMetalServerOptionsModel) + response, operationErr = vpcService.RemoveBareMetalServerNetworkInterfaceFloatingIP(removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) }) - It(`Invoke StopBareMetalServer with error: Operation validation and request error`, func() { + It(`Invoke RemoveBareMetalServerNetworkInterfaceFloatingIP with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -48849,22 +49993,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the StopBareMetalServerOptions model - stopBareMetalServerOptionsModel := new(vpcv1.StopBareMetalServerOptions) - stopBareMetalServerOptionsModel.ID = core.StringPtr("testString") - stopBareMetalServerOptionsModel.Type = core.StringPtr("hard") - stopBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RemoveBareMetalServerNetworkInterfaceFloatingIPOptions model + removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) + removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") + removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.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.StopBareMetalServer(stopBareMetalServerOptionsModel) + response, operationErr := vpcService.RemoveBareMetalServerNetworkInterfaceFloatingIP(removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - // Construct a second instance of the StopBareMetalServerOptions model with no property values - stopBareMetalServerOptionsModelNew := new(vpcv1.StopBareMetalServerOptions) + // Construct a second instance of the RemoveBareMetalServerNetworkInterfaceFloatingIPOptions model with no property values + removeBareMetalServerNetworkInterfaceFloatingIPOptionsModelNew := new(vpcv1.RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.StopBareMetalServer(stopBareMetalServerOptionsModelNew) + response, operationErr = vpcService.RemoveBareMetalServerNetworkInterfaceFloatingIP(removeBareMetalServerNetworkInterfaceFloatingIPOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) }) @@ -48873,27 +50018,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListVolumeProfiles(listVolumeProfilesOptions *ListVolumeProfilesOptions) - Operation response error`, func() { + Describe(`GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions) - Operation response error`, func() { version := "testString" - listVolumeProfilesPath := "/volume/profiles" + getBareMetalServerNetworkInterfaceFloatingIPPath := "/bare_metal_servers/testString/network_interfaces/testString/floating_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(listVolumeProfilesPath)) + Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerNetworkInterfaceFloatingIPPath)) 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(10))})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListVolumeProfiles with error: Operation response processing error`, func() { + It(`Invoke GetBareMetalServerNetworkInterfaceFloatingIP with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -48902,20 +50045,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListVolumeProfilesOptions model - listVolumeProfilesOptionsModel := new(vpcv1.ListVolumeProfilesOptions) - listVolumeProfilesOptionsModel.Start = core.StringPtr("testString") - listVolumeProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVolumeProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBareMetalServerNetworkInterfaceFloatingIPOptions model + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceFloatingIPOptions) + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.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.ListVolumeProfiles(listVolumeProfilesOptionsModel) + result, response, operationErr := vpcService.GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptionsModel) 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.ListVolumeProfiles(listVolumeProfilesOptionsModel) + result, response, operationErr = vpcService.GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -48925,32 +50069,30 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListVolumeProfiles(listVolumeProfilesOptions *ListVolumeProfilesOptions)`, func() { + Describe(`GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions)`, func() { version := "testString" - listVolumeProfilesPath := "/volume/profiles" + getBareMetalServerNetworkInterfaceFloatingIPPath := "/bare_metal_servers/testString/network_interfaces/testString/floating_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(listVolumeProfilesPath)) + Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerNetworkInterfaceFloatingIPPath)) 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(10))})) // 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/volume/profiles?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "profiles": [{"family": "tiered", "href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke ListVolumeProfiles successfully with retries`, func() { + It(`Invoke GetBareMetalServerNetworkInterfaceFloatingIP successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -48960,22 +50102,23 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListVolumeProfilesOptions model - listVolumeProfilesOptionsModel := new(vpcv1.ListVolumeProfilesOptions) - listVolumeProfilesOptionsModel.Start = core.StringPtr("testString") - listVolumeProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVolumeProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBareMetalServerNetworkInterfaceFloatingIPOptions model + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceFloatingIPOptions) + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.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.ListVolumeProfilesWithContext(ctx, listVolumeProfilesOptionsModel) + _, _, operationErr := vpcService.GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx, getBareMetalServerNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListVolumeProfiles(listVolumeProfilesOptionsModel) + result, response, operationErr := vpcService.GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -48983,7 +50126,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListVolumeProfilesWithContext(ctx, listVolumeProfilesOptionsModel) + _, _, operationErr = vpcService.GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx, getBareMetalServerNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -48997,20 +50140,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listVolumeProfilesPath)) + Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerNetworkInterfaceFloatingIPPath)) 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(10))})) // 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/volume/profiles?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "profiles": [{"family": "tiered", "href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke ListVolumeProfiles successfully`, func() { + It(`Invoke GetBareMetalServerNetworkInterfaceFloatingIP successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -49020,25 +50161,26 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListVolumeProfiles(nil) + result, response, operationErr := vpcService.GetBareMetalServerNetworkInterfaceFloatingIP(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListVolumeProfilesOptions model - listVolumeProfilesOptionsModel := new(vpcv1.ListVolumeProfilesOptions) - listVolumeProfilesOptionsModel.Start = core.StringPtr("testString") - listVolumeProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVolumeProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBareMetalServerNetworkInterfaceFloatingIPOptions model + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceFloatingIPOptions) + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListVolumeProfiles(listVolumeProfilesOptionsModel) + result, response, operationErr = vpcService.GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListVolumeProfiles with error: Operation request error`, func() { + It(`Invoke GetBareMetalServerNetworkInterfaceFloatingIP with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -49047,19 +50189,27 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListVolumeProfilesOptions model - listVolumeProfilesOptionsModel := new(vpcv1.ListVolumeProfilesOptions) - listVolumeProfilesOptionsModel.Start = core.StringPtr("testString") - listVolumeProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVolumeProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBareMetalServerNetworkInterfaceFloatingIPOptions model + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceFloatingIPOptions) + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.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.ListVolumeProfiles(listVolumeProfilesOptionsModel) + result, response, operationErr := vpcService.GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptionsModel) 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 GetBareMetalServerNetworkInterfaceFloatingIPOptions model with no property values + getBareMetalServerNetworkInterfaceFloatingIPOptionsModelNew := new(vpcv1.GetBareMetalServerNetworkInterfaceFloatingIPOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -49074,7 +50224,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListVolumeProfiles successfully`, func() { + It(`Invoke GetBareMetalServerNetworkInterfaceFloatingIP successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -49083,14 +50233,15 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListVolumeProfilesOptions model - listVolumeProfilesOptionsModel := new(vpcv1.ListVolumeProfilesOptions) - listVolumeProfilesOptionsModel.Start = core.StringPtr("testString") - listVolumeProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVolumeProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBareMetalServerNetworkInterfaceFloatingIPOptions model + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceFloatingIPOptions) + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListVolumeProfiles(listVolumeProfilesOptionsModel) + result, response, operationErr := vpcService.GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -49101,127 +50252,26 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) - Context(`Test pagination helper method on response`, func() { - It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.VolumeProfileCollection) - nextObject := new(vpcv1.VolumeProfileCollectionNext) - 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.VolumeProfileCollection) - - 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.VolumeProfileCollection) - nextObject := new(vpcv1.VolumeProfileCollectionNext) - nextObject.Href = core.StringPtr("ibm.com") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - }) - Context(`Using mock server endpoint - paginated response`, func() { - BeforeEach(func() { - var requestNumber int = 0 - 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(listVolumeProfilesPath)) - Expect(req.Method).To(Equal("GET")) - - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - requestNumber++ - if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"profiles":[{"family":"tiered","href":"https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose","name":"general-purpose"}]}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"profiles":[{"family":"tiered","href":"https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose","name":"general-purpose"}]}`) - } else { - res.WriteHeader(400) - } - })) - }) - It(`Use VolumeProfilesPager.GetNext 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()) - - listVolumeProfilesOptionsModel := &vpcv1.ListVolumeProfilesOptions{ - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewVolumeProfilesPager(listVolumeProfilesOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.VolumeProfile - for pager.HasNext() { - nextPage, err := pager.GetNext() - Expect(err).To(BeNil()) - Expect(nextPage).ToNot(BeNil()) - allResults = append(allResults, nextPage...) - } - Expect(len(allResults)).To(Equal(2)) - }) - It(`Use VolumeProfilesPager.GetAll 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()) - - listVolumeProfilesOptionsModel := &vpcv1.ListVolumeProfilesOptions{ - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewVolumeProfilesPager(listVolumeProfilesOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - allResults, err := pager.GetAll() - Expect(err).To(BeNil()) - Expect(allResults).ToNot(BeNil()) - Expect(len(allResults)).To(Equal(2)) - }) - }) }) - Describe(`GetVolumeProfile(getVolumeProfileOptions *GetVolumeProfileOptions) - Operation response error`, func() { + Describe(`AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions) - Operation response error`, func() { version := "testString" - getVolumeProfilePath := "/volume/profiles/testString" + addBareMetalServerNetworkInterfaceFloatingIPPath := "/bare_metal_servers/testString/network_interfaces/testString/floating_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(getVolumeProfilePath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(addBareMetalServerNetworkInterfaceFloatingIPPath)) + Expect(req.Method).To(Equal("PUT")) 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) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetVolumeProfile with error: Operation response processing error`, func() { + It(`Invoke AddBareMetalServerNetworkInterfaceFloatingIP with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -49230,19 +50280,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetVolumeProfileOptions model - getVolumeProfileOptionsModel := new(vpcv1.GetVolumeProfileOptions) - getVolumeProfileOptionsModel.Name = core.StringPtr("testString") - getVolumeProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddBareMetalServerNetworkInterfaceFloatingIPOptions model + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddBareMetalServerNetworkInterfaceFloatingIPOptions) + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.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.GetVolumeProfile(getVolumeProfileOptionsModel) + result, response, operationErr := vpcService.AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptionsModel) 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.GetVolumeProfile(getVolumeProfileOptionsModel) + result, response, operationErr = vpcService.AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -49252,17 +50304,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetVolumeProfile(getVolumeProfileOptions *GetVolumeProfileOptions)`, func() { + Describe(`AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions)`, func() { version := "testString" - getVolumeProfilePath := "/volume/profiles/testString" + addBareMetalServerNetworkInterfaceFloatingIPPath := "/bare_metal_servers/testString/network_interfaces/testString/floating_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(getVolumeProfilePath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(addBareMetalServerNetworkInterfaceFloatingIPPath)) + Expect(req.Method).To(Equal("PUT")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -49271,11 +50323,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"family": "tiered", "href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke GetVolumeProfile successfully with retries`, func() { + It(`Invoke AddBareMetalServerNetworkInterfaceFloatingIP successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -49285,21 +50337,23 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetVolumeProfileOptions model - getVolumeProfileOptionsModel := new(vpcv1.GetVolumeProfileOptions) - getVolumeProfileOptionsModel.Name = core.StringPtr("testString") - getVolumeProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddBareMetalServerNetworkInterfaceFloatingIPOptions model + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddBareMetalServerNetworkInterfaceFloatingIPOptions) + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.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.GetVolumeProfileWithContext(ctx, getVolumeProfileOptionsModel) + _, _, operationErr := vpcService.AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx, addBareMetalServerNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetVolumeProfile(getVolumeProfileOptionsModel) + result, response, operationErr := vpcService.AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -49307,7 +50361,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetVolumeProfileWithContext(ctx, getVolumeProfileOptionsModel) + _, _, operationErr = vpcService.AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx, addBareMetalServerNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -49321,18 +50375,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getVolumeProfilePath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(addBareMetalServerNetworkInterfaceFloatingIPPath)) + Expect(req.Method).To(Equal("PUT")) 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", `{"family": "tiered", "href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "status": "available", "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-instance-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke GetVolumeProfile successfully`, func() { + It(`Invoke AddBareMetalServerNetworkInterfaceFloatingIP successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -49342,24 +50396,26 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetVolumeProfile(nil) + result, response, operationErr := vpcService.AddBareMetalServerNetworkInterfaceFloatingIP(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetVolumeProfileOptions model - getVolumeProfileOptionsModel := new(vpcv1.GetVolumeProfileOptions) - getVolumeProfileOptionsModel.Name = core.StringPtr("testString") - getVolumeProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddBareMetalServerNetworkInterfaceFloatingIPOptions model + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddBareMetalServerNetworkInterfaceFloatingIPOptions) + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetVolumeProfile(getVolumeProfileOptionsModel) + result, response, operationErr = vpcService.AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetVolumeProfile with error: Operation validation and request error`, func() { + It(`Invoke AddBareMetalServerNetworkInterfaceFloatingIP with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -49368,22 +50424,24 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetVolumeProfileOptions model - getVolumeProfileOptionsModel := new(vpcv1.GetVolumeProfileOptions) - getVolumeProfileOptionsModel.Name = core.StringPtr("testString") - getVolumeProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddBareMetalServerNetworkInterfaceFloatingIPOptions model + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddBareMetalServerNetworkInterfaceFloatingIPOptions) + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.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.GetVolumeProfile(getVolumeProfileOptionsModel) + result, response, operationErr := vpcService.AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptionsModel) 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 GetVolumeProfileOptions model with no property values - getVolumeProfileOptionsModelNew := new(vpcv1.GetVolumeProfileOptions) + // Construct a second instance of the AddBareMetalServerNetworkInterfaceFloatingIPOptions model with no property values + addBareMetalServerNetworkInterfaceFloatingIPOptionsModelNew := new(vpcv1.AddBareMetalServerNetworkInterfaceFloatingIPOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetVolumeProfile(getVolumeProfileOptionsModelNew) + result, response, operationErr = vpcService.AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -49398,10 +50456,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke GetVolumeProfile successfully`, func() { + It(`Invoke AddBareMetalServerNetworkInterfaceFloatingIP successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -49410,13 +50468,15 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetVolumeProfileOptions model - getVolumeProfileOptionsModel := new(vpcv1.GetVolumeProfileOptions) - getVolumeProfileOptionsModel.Name = core.StringPtr("testString") - getVolumeProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddBareMetalServerNetworkInterfaceFloatingIPOptions model + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddBareMetalServerNetworkInterfaceFloatingIPOptions) + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID = core.StringPtr("testString") + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetVolumeProfile(getVolumeProfileOptionsModel) + result, response, operationErr := vpcService.AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -49428,33 +50488,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListVolumes(listVolumesOptions *ListVolumesOptions) - Operation response error`, func() { + Describe(`ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions) - Operation response error`, func() { version := "testString" - listVolumesPath := "/volumes" + 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(listVolumesPath)) + 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))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["attachment_state"]).To(Equal([]string{"attached"})) - Expect(req.URL.Query()["encryption"]).To(Equal([]string{"provider_managed"})) - Expect(req.URL.Query()["operating_system.family"]).To(Equal([]string{"Ubuntu Server"})) - Expect(req.URL.Query()["operating_system.architecture"]).To(Equal([]string{"amd64"})) - Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"us-south-1"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListVolumes with error: Operation response processing error`, func() { + It(`Invoke ListBareMetalServerNetworkInterfaceIps with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -49463,26 +50515,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListVolumesOptions model - listVolumesOptionsModel := new(vpcv1.ListVolumesOptions) - listVolumesOptionsModel.Start = core.StringPtr("testString") - listVolumesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVolumesOptionsModel.Name = core.StringPtr("testString") - listVolumesOptionsModel.AttachmentState = core.StringPtr("attached") - listVolumesOptionsModel.Encryption = core.StringPtr("provider_managed") - listVolumesOptionsModel.OperatingSystemFamily = core.StringPtr("Ubuntu Server") - listVolumesOptionsModel.OperatingSystemArchitecture = core.StringPtr("amd64") - listVolumesOptionsModel.ZoneName = core.StringPtr("us-south-1") - listVolumesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // 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.ListVolumes(listVolumesOptionsModel) + 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.ListVolumes(listVolumesOptionsModel) + result, response, operationErr = vpcService.ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -49492,38 +50538,30 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListVolumes(listVolumesOptions *ListVolumesOptions)`, func() { + Describe(`ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions)`, func() { version := "testString" - listVolumesPath := "/volumes" + 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(listVolumesPath)) + 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))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["attachment_state"]).To(Equal([]string{"attached"})) - Expect(req.URL.Query()["encryption"]).To(Equal([]string{"provider_managed"})) - Expect(req.URL.Query()["operating_system.family"]).To(Equal([]string{"Ubuntu Server"})) - Expect(req.URL.Query()["operating_system.architecture"]).To(Equal([]string{"amd64"})) - Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"us-south-1"})) // 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/volumes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volumes?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132, "volumes": [{"active": true, "attachment_state": "attached", "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "Message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["UserTags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "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", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/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:r134-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/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-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/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e/ips?start=a404e343444b4e1095c9edba76672d67&limit=20"}, "total_count": 132}`) })) }) - It(`Invoke ListVolumes successfully with retries`, func() { + It(`Invoke ListBareMetalServerNetworkInterfaceIps successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -49533,28 +50571,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListVolumesOptions model - listVolumesOptionsModel := new(vpcv1.ListVolumesOptions) - listVolumesOptionsModel.Start = core.StringPtr("testString") - listVolumesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVolumesOptionsModel.Name = core.StringPtr("testString") - listVolumesOptionsModel.AttachmentState = core.StringPtr("attached") - listVolumesOptionsModel.Encryption = core.StringPtr("provider_managed") - listVolumesOptionsModel.OperatingSystemFamily = core.StringPtr("Ubuntu Server") - listVolumesOptionsModel.OperatingSystemArchitecture = core.StringPtr("amd64") - listVolumesOptionsModel.ZoneName = core.StringPtr("us-south-1") - listVolumesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // 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.ListVolumesWithContext(ctx, listVolumesOptionsModel) + _, _, 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.ListVolumes(listVolumesOptionsModel) + result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -49562,7 +50594,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListVolumesWithContext(ctx, listVolumesOptionsModel) + _, _, operationErr = vpcService.ListBareMetalServerNetworkInterfaceIpsWithContext(ctx, listBareMetalServerNetworkInterfaceIpsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -49576,26 +50608,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listVolumesPath)) + 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))})) - Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["attachment_state"]).To(Equal([]string{"attached"})) - Expect(req.URL.Query()["encryption"]).To(Equal([]string{"provider_managed"})) - Expect(req.URL.Query()["operating_system.family"]).To(Equal([]string{"Ubuntu Server"})) - Expect(req.URL.Query()["operating_system.architecture"]).To(Equal([]string{"amd64"})) - Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"us-south-1"})) // 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/volumes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volumes?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132, "volumes": [{"active": true, "attachment_state": "attached", "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "Message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["UserTags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "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", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/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:r134-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/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-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/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e/ips?start=a404e343444b4e1095c9edba76672d67&limit=20"}, "total_count": 132}`) })) }) - It(`Invoke ListVolumes successfully`, func() { + It(`Invoke ListBareMetalServerNetworkInterfaceIps successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -49605,31 +50629,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListVolumes(nil) + result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaceIps(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListVolumesOptions model - listVolumesOptionsModel := new(vpcv1.ListVolumesOptions) - listVolumesOptionsModel.Start = core.StringPtr("testString") - listVolumesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVolumesOptionsModel.Name = core.StringPtr("testString") - listVolumesOptionsModel.AttachmentState = core.StringPtr("attached") - listVolumesOptionsModel.Encryption = core.StringPtr("provider_managed") - listVolumesOptionsModel.OperatingSystemFamily = core.StringPtr("Ubuntu Server") - listVolumesOptionsModel.OperatingSystemArchitecture = core.StringPtr("amd64") - listVolumesOptionsModel.ZoneName = core.StringPtr("us-south-1") - listVolumesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // 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.ListVolumes(listVolumesOptionsModel) + result, response, operationErr = vpcService.ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListVolumes with error: Operation request error`, func() { + It(`Invoke ListBareMetalServerNetworkInterfaceIps with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -49638,25 +50656,26 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListVolumesOptions model - listVolumesOptionsModel := new(vpcv1.ListVolumesOptions) - listVolumesOptionsModel.Start = core.StringPtr("testString") - listVolumesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVolumesOptionsModel.Name = core.StringPtr("testString") - listVolumesOptionsModel.AttachmentState = core.StringPtr("attached") - listVolumesOptionsModel.Encryption = core.StringPtr("provider_managed") - listVolumesOptionsModel.OperatingSystemFamily = core.StringPtr("Ubuntu Server") - listVolumesOptionsModel.OperatingSystemArchitecture = core.StringPtr("amd64") - listVolumesOptionsModel.ZoneName = core.StringPtr("us-south-1") - listVolumesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // 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.ListVolumes(listVolumesOptionsModel) + 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() @@ -49671,7 +50690,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListVolumes successfully`, func() { + It(`Invoke ListBareMetalServerNetworkInterfaceIps successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -49680,20 +50699,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListVolumesOptions model - listVolumesOptionsModel := new(vpcv1.ListVolumesOptions) - listVolumesOptionsModel.Start = core.StringPtr("testString") - listVolumesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVolumesOptionsModel.Name = core.StringPtr("testString") - listVolumesOptionsModel.AttachmentState = core.StringPtr("attached") - listVolumesOptionsModel.Encryption = core.StringPtr("provider_managed") - listVolumesOptionsModel.OperatingSystemFamily = core.StringPtr("Ubuntu Server") - listVolumesOptionsModel.OperatingSystemArchitecture = core.StringPtr("amd64") - listVolumesOptionsModel.ZoneName = core.StringPtr("us-south-1") - listVolumesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // 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.ListVolumes(listVolumesOptionsModel) + result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -49704,139 +50717,26 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) - Context(`Test pagination helper method on response`, func() { - It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.VolumeCollection) - nextObject := new(vpcv1.VolumeCollectionNext) - 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.VolumeCollection) - - 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.VolumeCollection) - nextObject := new(vpcv1.VolumeCollectionNext) - nextObject.Href = core.StringPtr("ibm.com") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - }) - Context(`Using mock server endpoint - paginated response`, func() { - BeforeEach(func() { - var requestNumber int = 0 - 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(listVolumesPath)) - Expect(req.Method).To(Equal("GET")) - - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - requestNumber++ - if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"volumes":[{"active":true,"attachment_state":"attached","bandwidth":1000,"busy":true,"capacity":1000,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5","encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"health_reasons":[{"code":"initializing_from_snapshot","message":"Performance will be degraded while this volume is being initialized from its snapshot","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","iops":10000,"name":"my-volume","operating_system":{"architecture":"amd64","dedicated_host_only":false,"display_name":"Ubuntu Server 16.04 LTS amd64","family":"Ubuntu Server","href":"https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64","name":"ubuntu-16-amd64","vendor":"Canonical","version":"16.04 LTS"},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose","name":"general-purpose"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"volume","source_image":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"aa2432b1fa4d4ace891e9b80fc104e34","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"},"status":"available","status_reasons":[{"code":"encryption_key_deleted","message":"Message","more_info":"https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}],"user_tags":["UserTags"],"volume_attachments":[{"delete_volume_on_instance_delete":true,"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"device":{"id":"80b3e36e-41f4-40e9-bd56-beae81792a68"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"82cbf856-9cbb-45fb-b62f-d7bcef32399a","instance":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance"},"name":"my-volume-attachment","type":"boot"}],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}]}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"volumes":[{"active":true,"attachment_state":"attached","bandwidth":1000,"busy":true,"capacity":1000,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5","encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"health_reasons":[{"code":"initializing_from_snapshot","message":"Performance will be degraded while this volume is being initialized from its snapshot","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","iops":10000,"name":"my-volume","operating_system":{"architecture":"amd64","dedicated_host_only":false,"display_name":"Ubuntu Server 16.04 LTS amd64","family":"Ubuntu Server","href":"https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64","name":"ubuntu-16-amd64","vendor":"Canonical","version":"16.04 LTS"},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose","name":"general-purpose"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"volume","source_image":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"aa2432b1fa4d4ace891e9b80fc104e34","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"},"status":"available","status_reasons":[{"code":"encryption_key_deleted","message":"Message","more_info":"https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}],"user_tags":["UserTags"],"volume_attachments":[{"delete_volume_on_instance_delete":true,"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"device":{"id":"80b3e36e-41f4-40e9-bd56-beae81792a68"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"82cbf856-9cbb-45fb-b62f-d7bcef32399a","instance":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance"},"name":"my-volume-attachment","type":"boot"}],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}]}`) - } else { - res.WriteHeader(400) - } - })) - }) - It(`Use VolumesPager.GetNext 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()) - - listVolumesOptionsModel := &vpcv1.ListVolumesOptions{ - Limit: core.Int64Ptr(int64(10)), - Name: core.StringPtr("testString"), - AttachmentState: core.StringPtr("attached"), - Encryption: core.StringPtr("provider_managed"), - OperatingSystemFamily: core.StringPtr("Ubuntu Server"), - OperatingSystemArchitecture: core.StringPtr("amd64"), - ZoneName: core.StringPtr("us-south-1"), - } - - pager, err := vpcService.NewVolumesPager(listVolumesOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.Volume - for pager.HasNext() { - nextPage, err := pager.GetNext() - Expect(err).To(BeNil()) - Expect(nextPage).ToNot(BeNil()) - allResults = append(allResults, nextPage...) - } - Expect(len(allResults)).To(Equal(2)) - }) - It(`Use VolumesPager.GetAll 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()) - - listVolumesOptionsModel := &vpcv1.ListVolumesOptions{ - Limit: core.Int64Ptr(int64(10)), - Name: core.StringPtr("testString"), - AttachmentState: core.StringPtr("attached"), - Encryption: core.StringPtr("provider_managed"), - OperatingSystemFamily: core.StringPtr("Ubuntu Server"), - OperatingSystemArchitecture: core.StringPtr("amd64"), - ZoneName: core.StringPtr("us-south-1"), - } - - pager, err := vpcService.NewVolumesPager(listVolumesOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - allResults, err := pager.GetAll() - Expect(err).To(BeNil()) - Expect(allResults).ToNot(BeNil()) - Expect(len(allResults)).To(Equal(2)) - }) - }) }) - Describe(`CreateVolume(createVolumeOptions *CreateVolumeOptions) - Operation response error`, func() { + Describe(`GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) - Operation response error`, func() { version := "testString" - createVolumePath := "/volumes" + 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(createVolumePath)) - Expect(req.Method).To(Equal("POST")) + 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(201) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateVolume with error: Operation response processing error`, func() { + It(`Invoke GetBareMetalServerNetworkInterfaceIP with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -49845,46 +50745,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VolumeProfileIdentityByName model - volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) - volumeProfileIdentityModel.Name = core.StringPtr("5iops-tier") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the VolumePrototypeVolumeByCapacity model - volumePrototypeModel := new(vpcv1.VolumePrototypeVolumeByCapacity) - volumePrototypeModel.Iops = core.Int64Ptr(int64(10000)) - volumePrototypeModel.Name = core.StringPtr("my-volume") - volumePrototypeModel.Profile = volumeProfileIdentityModel - volumePrototypeModel.ResourceGroup = resourceGroupIdentityModel - volumePrototypeModel.UserTags = []string{} - volumePrototypeModel.Zone = zoneIdentityModel - volumePrototypeModel.Capacity = core.Int64Ptr(int64(100)) - volumePrototypeModel.EncryptionKey = encryptionKeyIdentityModel - - // Construct an instance of the CreateVolumeOptions model - createVolumeOptionsModel := new(vpcv1.CreateVolumeOptions) - createVolumeOptionsModel.VolumePrototype = volumePrototypeModel - createVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // 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.CreateVolume(createVolumeOptionsModel) + 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.CreateVolume(createVolumeOptionsModel) + result, response, operationErr = vpcService.GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -49894,33 +50769,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateVolume(createVolumeOptions *CreateVolumeOptions)`, func() { + Describe(`GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions)`, func() { version := "testString" - createVolumePath := "/volumes" + 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(createVolumePath)) - 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.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))})) @@ -49929,11 +50788,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"active": true, "attachment_state": "attached", "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "Message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["UserTags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + 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:r134-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/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}`) })) }) - It(`Invoke CreateVolume successfully with retries`, func() { + It(`Invoke GetBareMetalServerNetworkInterfaceIP successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -49943,48 +50802,23 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the VolumeProfileIdentityByName model - volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) - volumeProfileIdentityModel.Name = core.StringPtr("5iops-tier") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the VolumePrototypeVolumeByCapacity model - volumePrototypeModel := new(vpcv1.VolumePrototypeVolumeByCapacity) - volumePrototypeModel.Iops = core.Int64Ptr(int64(10000)) - volumePrototypeModel.Name = core.StringPtr("my-volume") - volumePrototypeModel.Profile = volumeProfileIdentityModel - volumePrototypeModel.ResourceGroup = resourceGroupIdentityModel - volumePrototypeModel.UserTags = []string{} - volumePrototypeModel.Zone = zoneIdentityModel - volumePrototypeModel.Capacity = core.Int64Ptr(int64(100)) - volumePrototypeModel.EncryptionKey = encryptionKeyIdentityModel - - // Construct an instance of the CreateVolumeOptions model - createVolumeOptionsModel := new(vpcv1.CreateVolumeOptions) - createVolumeOptionsModel.VolumePrototype = volumePrototypeModel - createVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // 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.CreateVolumeWithContext(ctx, createVolumeOptionsModel) + _, _, 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.CreateVolume(createVolumeOptionsModel) + result, response, operationErr := vpcService.GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -49992,7 +50826,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreateVolumeWithContext(ctx, createVolumeOptionsModel) + _, _, operationErr = vpcService.GetBareMetalServerNetworkInterfaceIPWithContext(ctx, getBareMetalServerNetworkInterfaceIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -50006,34 +50840,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createVolumePath)) - 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.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(201) - fmt.Fprintf(res, "%s", `{"active": true, "attachment_state": "attached", "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "Message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["UserTags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + 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:r134-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/r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r134-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}`) })) }) - It(`Invoke CreateVolume successfully`, func() { + It(`Invoke GetBareMetalServerNetworkInterfaceIP successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -50043,51 +50861,26 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreateVolume(nil) + result, response, operationErr := vpcService.GetBareMetalServerNetworkInterfaceIP(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the VolumeProfileIdentityByName model - volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) - volumeProfileIdentityModel.Name = core.StringPtr("5iops-tier") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") + // 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"} - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the VolumePrototypeVolumeByCapacity model - volumePrototypeModel := new(vpcv1.VolumePrototypeVolumeByCapacity) - volumePrototypeModel.Iops = core.Int64Ptr(int64(10000)) - volumePrototypeModel.Name = core.StringPtr("my-volume") - volumePrototypeModel.Profile = volumeProfileIdentityModel - volumePrototypeModel.ResourceGroup = resourceGroupIdentityModel - volumePrototypeModel.UserTags = []string{} - volumePrototypeModel.Zone = zoneIdentityModel - volumePrototypeModel.Capacity = core.Int64Ptr(int64(100)) - volumePrototypeModel.EncryptionKey = encryptionKeyIdentityModel - - // Construct an instance of the CreateVolumeOptions model - createVolumeOptionsModel := new(vpcv1.CreateVolumeOptions) - createVolumeOptionsModel.VolumePrototype = volumePrototypeModel - createVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateVolume(createVolumeOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) + // 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 CreateVolume with error: Operation validation and request error`, func() { + It(`Invoke GetBareMetalServerNetworkInterfaceIP with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -50096,49 +50889,24 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VolumeProfileIdentityByName model - volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) - volumeProfileIdentityModel.Name = core.StringPtr("5iops-tier") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the VolumePrototypeVolumeByCapacity model - volumePrototypeModel := new(vpcv1.VolumePrototypeVolumeByCapacity) - volumePrototypeModel.Iops = core.Int64Ptr(int64(10000)) - volumePrototypeModel.Name = core.StringPtr("my-volume") - volumePrototypeModel.Profile = volumeProfileIdentityModel - volumePrototypeModel.ResourceGroup = resourceGroupIdentityModel - volumePrototypeModel.UserTags = []string{} - volumePrototypeModel.Zone = zoneIdentityModel - volumePrototypeModel.Capacity = core.Int64Ptr(int64(100)) - volumePrototypeModel.EncryptionKey = encryptionKeyIdentityModel - - // Construct an instance of the CreateVolumeOptions model - createVolumeOptionsModel := new(vpcv1.CreateVolumeOptions) - createVolumeOptionsModel.VolumePrototype = volumePrototypeModel - createVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // 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.CreateVolume(createVolumeOptionsModel) + 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 CreateVolumeOptions model with no property values - createVolumeOptionsModelNew := new(vpcv1.CreateVolumeOptions) + // 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.CreateVolume(createVolumeOptionsModelNew) + result, response, operationErr = vpcService.GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -50153,10 +50921,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke CreateVolume successfully`, func() { + It(`Invoke GetBareMetalServerNetworkInterfaceIP successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -50165,40 +50933,15 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VolumeProfileIdentityByName model - volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) - volumeProfileIdentityModel.Name = core.StringPtr("5iops-tier") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the VolumePrototypeVolumeByCapacity model - volumePrototypeModel := new(vpcv1.VolumePrototypeVolumeByCapacity) - volumePrototypeModel.Iops = core.Int64Ptr(int64(10000)) - volumePrototypeModel.Name = core.StringPtr("my-volume") - volumePrototypeModel.Profile = volumeProfileIdentityModel - volumePrototypeModel.ResourceGroup = resourceGroupIdentityModel - volumePrototypeModel.UserTags = []string{} - volumePrototypeModel.Zone = zoneIdentityModel - volumePrototypeModel.Capacity = core.Int64Ptr(int64(100)) - volumePrototypeModel.EncryptionKey = encryptionKeyIdentityModel - - // Construct an instance of the CreateVolumeOptions model - createVolumeOptionsModel := new(vpcv1.CreateVolumeOptions) - createVolumeOptionsModel.VolumePrototype = volumePrototypeModel - createVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // 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.CreateVolume(createVolumeOptionsModel) + result, response, operationErr := vpcService.GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -50210,26 +50953,24 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteVolume(deleteVolumeOptions *DeleteVolumeOptions)`, func() { + Describe(`DeleteBareMetalServer(deleteBareMetalServerOptions *DeleteBareMetalServerOptions)`, func() { version := "testString" - deleteVolumePath := "/volumes/testString" + deleteBareMetalServerPath := "/bare_metal_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(deleteVolumePath)) + Expect(req.URL.EscapedPath()).To(Equal(deleteBareMetalServerPath)) 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) + res.WriteHeader(202) })) }) - It(`Invoke DeleteVolume successfully`, func() { + It(`Invoke DeleteBareMetalServer successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -50239,22 +50980,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.DeleteVolume(nil) + response, operationErr := vpcService.DeleteBareMetalServer(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) - // Construct an instance of the DeleteVolumeOptions model - deleteVolumeOptionsModel := new(vpcv1.DeleteVolumeOptions) - deleteVolumeOptionsModel.ID = core.StringPtr("testString") - deleteVolumeOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - deleteVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteBareMetalServerOptions model + deleteBareMetalServerOptionsModel := new(vpcv1.DeleteBareMetalServerOptions) + deleteBareMetalServerOptionsModel.ID = core.StringPtr("testString") + deleteBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteVolume(deleteVolumeOptionsModel) + response, operationErr = vpcService.DeleteBareMetalServer(deleteBareMetalServerOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) }) - It(`Invoke DeleteVolume with error: Operation validation and request error`, func() { + It(`Invoke DeleteBareMetalServer with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -50263,22 +51003,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteVolumeOptions model - deleteVolumeOptionsModel := new(vpcv1.DeleteVolumeOptions) - deleteVolumeOptionsModel.ID = core.StringPtr("testString") - deleteVolumeOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - deleteVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteBareMetalServerOptions model + deleteBareMetalServerOptionsModel := new(vpcv1.DeleteBareMetalServerOptions) + deleteBareMetalServerOptionsModel.ID = core.StringPtr("testString") + deleteBareMetalServerOptionsModel.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.DeleteVolume(deleteVolumeOptionsModel) + response, operationErr := vpcService.DeleteBareMetalServer(deleteBareMetalServerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - // Construct a second instance of the DeleteVolumeOptions model with no property values - deleteVolumeOptionsModelNew := new(vpcv1.DeleteVolumeOptions) + // Construct a second instance of the DeleteBareMetalServerOptions model with no property values + deleteBareMetalServerOptionsModelNew := new(vpcv1.DeleteBareMetalServerOptions) // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteVolume(deleteVolumeOptionsModelNew) + response, operationErr = vpcService.DeleteBareMetalServer(deleteBareMetalServerOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) }) @@ -50287,16 +51026,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetVolume(getVolumeOptions *GetVolumeOptions) - Operation response error`, func() { + Describe(`GetBareMetalServer(getBareMetalServerOptions *GetBareMetalServerOptions) - Operation response error`, func() { version := "testString" - getVolumePath := "/volumes/testString" + getBareMetalServerPath := "/bare_metal_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(getVolumePath)) + Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerPath)) 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))})) @@ -50305,7 +51044,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetVolume with error: Operation response processing error`, func() { + It(`Invoke GetBareMetalServer with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -50314,19 +51053,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetVolumeOptions model - getVolumeOptionsModel := new(vpcv1.GetVolumeOptions) - getVolumeOptionsModel.ID = core.StringPtr("testString") - getVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBareMetalServerOptions model + getBareMetalServerOptionsModel := new(vpcv1.GetBareMetalServerOptions) + getBareMetalServerOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerOptionsModel.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.GetVolume(getVolumeOptionsModel) + result, response, operationErr := vpcService.GetBareMetalServer(getBareMetalServerOptionsModel) 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.GetVolume(getVolumeOptionsModel) + result, response, operationErr = vpcService.GetBareMetalServer(getBareMetalServerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -50336,16 +51075,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetVolume(getVolumeOptions *GetVolumeOptions)`, func() { + Describe(`GetBareMetalServer(getBareMetalServerOptions *GetBareMetalServerOptions)`, func() { version := "testString" - getVolumePath := "/volumes/testString" + getBareMetalServerPath := "/bare_metal_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(getVolumePath)) + Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -50356,10 +51095,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"active": true, "attachment_state": "attached", "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "Message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["UserTags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "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", `{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "name": "my-bare-metal-server", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"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"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"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"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}], "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"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"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"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"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "deleting", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "disabled", "supported_modes": ["disabled"]}, "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"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke GetVolume successfully with retries`, func() { + It(`Invoke GetBareMetalServer successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -50369,21 +51108,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetVolumeOptions model - getVolumeOptionsModel := new(vpcv1.GetVolumeOptions) - getVolumeOptionsModel.ID = core.StringPtr("testString") - getVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBareMetalServerOptions model + getBareMetalServerOptionsModel := new(vpcv1.GetBareMetalServerOptions) + getBareMetalServerOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerOptionsModel.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.GetVolumeWithContext(ctx, getVolumeOptionsModel) + _, _, operationErr := vpcService.GetBareMetalServerWithContext(ctx, getBareMetalServerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetVolume(getVolumeOptionsModel) + result, response, operationErr := vpcService.GetBareMetalServer(getBareMetalServerOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -50391,7 +51130,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetVolumeWithContext(ctx, getVolumeOptionsModel) + _, _, operationErr = vpcService.GetBareMetalServerWithContext(ctx, getBareMetalServerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -50405,7 +51144,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getVolumePath)) + Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -50413,10 +51152,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"active": true, "attachment_state": "attached", "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "Message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["UserTags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "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", `{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "name": "my-bare-metal-server", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"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"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"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"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}], "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"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"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"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"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "deleting", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "disabled", "supported_modes": ["disabled"]}, "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"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke GetVolume successfully`, func() { + It(`Invoke GetBareMetalServer successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -50426,24 +51165,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetVolume(nil) + result, response, operationErr := vpcService.GetBareMetalServer(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetVolumeOptions model - getVolumeOptionsModel := new(vpcv1.GetVolumeOptions) - getVolumeOptionsModel.ID = core.StringPtr("testString") - getVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBareMetalServerOptions model + getBareMetalServerOptionsModel := new(vpcv1.GetBareMetalServerOptions) + getBareMetalServerOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetVolume(getVolumeOptionsModel) + result, response, operationErr = vpcService.GetBareMetalServer(getBareMetalServerOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetVolume with error: Operation validation and request error`, func() { + It(`Invoke GetBareMetalServer with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -50452,22 +51191,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetVolumeOptions model - getVolumeOptionsModel := new(vpcv1.GetVolumeOptions) - getVolumeOptionsModel.ID = core.StringPtr("testString") - getVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBareMetalServerOptions model + getBareMetalServerOptionsModel := new(vpcv1.GetBareMetalServerOptions) + getBareMetalServerOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerOptionsModel.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.GetVolume(getVolumeOptionsModel) + result, response, operationErr := vpcService.GetBareMetalServer(getBareMetalServerOptionsModel) 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 GetVolumeOptions model with no property values - getVolumeOptionsModelNew := new(vpcv1.GetVolumeOptions) + // Construct a second instance of the GetBareMetalServerOptions model with no property values + getBareMetalServerOptionsModelNew := new(vpcv1.GetBareMetalServerOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetVolume(getVolumeOptionsModelNew) + result, response, operationErr = vpcService.GetBareMetalServer(getBareMetalServerOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -50485,7 +51224,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetVolume successfully`, func() { + It(`Invoke GetBareMetalServer successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -50494,13 +51233,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetVolumeOptions model - getVolumeOptionsModel := new(vpcv1.GetVolumeOptions) - getVolumeOptionsModel.ID = core.StringPtr("testString") - getVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBareMetalServerOptions model + getBareMetalServerOptionsModel := new(vpcv1.GetBareMetalServerOptions) + getBareMetalServerOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetVolume(getVolumeOptionsModel) + result, response, operationErr := vpcService.GetBareMetalServer(getBareMetalServerOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -50512,19 +51251,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateVolume(updateVolumeOptions *UpdateVolumeOptions) - Operation response error`, func() { + Describe(`UpdateBareMetalServer(updateBareMetalServerOptions *UpdateBareMetalServerOptions) - Operation response error`, func() { version := "testString" - updateVolumePath := "/volumes/testString" + updateBareMetalServerPath := "/bare_metal_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(updateVolumePath)) + Expect(req.URL.EscapedPath()).To(Equal(updateBareMetalServerPath)) 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") @@ -50532,7 +51269,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateVolume with error: Operation response processing error`, func() { + It(`Invoke UpdateBareMetalServer with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -50541,35 +51278,32 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VolumeProfileIdentityByName model - volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) - volumeProfileIdentityModel.Name = core.StringPtr("general-purpose") + // Construct an instance of the BareMetalServerTrustedPlatformModulePatch model + bareMetalServerTrustedPlatformModulePatchModel := new(vpcv1.BareMetalServerTrustedPlatformModulePatch) + bareMetalServerTrustedPlatformModulePatchModel.Mode = core.StringPtr("disabled") - // Construct an instance of the VolumePatch model - volumePatchModel := new(vpcv1.VolumePatch) - volumePatchModel.Capacity = core.Int64Ptr(int64(100)) - volumePatchModel.Iops = core.Int64Ptr(int64(10000)) - volumePatchModel.Name = core.StringPtr("my-volume") - volumePatchModel.Profile = volumeProfileIdentityModel - volumePatchModel.UserTags = []string{"testString"} - volumePatchModelAsPatch, asPatchErr := volumePatchModel.AsPatch() + // Construct an instance of the BareMetalServerPatch model + bareMetalServerPatchModel := new(vpcv1.BareMetalServerPatch) + bareMetalServerPatchModel.EnableSecureBoot = core.BoolPtr(false) + bareMetalServerPatchModel.Name = core.StringPtr("my-bare-metal-server") + bareMetalServerPatchModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePatchModel + bareMetalServerPatchModelAsPatch, asPatchErr := bareMetalServerPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateVolumeOptions model - updateVolumeOptionsModel := new(vpcv1.UpdateVolumeOptions) - updateVolumeOptionsModel.ID = core.StringPtr("testString") - updateVolumeOptionsModel.VolumePatch = volumePatchModelAsPatch - updateVolumeOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateBareMetalServerOptions model + updateBareMetalServerOptionsModel := new(vpcv1.UpdateBareMetalServerOptions) + updateBareMetalServerOptionsModel.ID = core.StringPtr("testString") + updateBareMetalServerOptionsModel.BareMetalServerPatch = bareMetalServerPatchModelAsPatch + updateBareMetalServerOptionsModel.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.UpdateVolume(updateVolumeOptionsModel) + result, response, operationErr := vpcService.UpdateBareMetalServer(updateBareMetalServerOptionsModel) 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.UpdateVolume(updateVolumeOptionsModel) + result, response, operationErr = vpcService.UpdateBareMetalServer(updateBareMetalServerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -50579,16 +51313,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateVolume(updateVolumeOptions *UpdateVolumeOptions)`, func() { + Describe(`UpdateBareMetalServer(updateBareMetalServerOptions *UpdateBareMetalServerOptions)`, func() { version := "testString" - updateVolumePath := "/volumes/testString" + updateBareMetalServerPath := "/bare_metal_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(updateVolumePath)) + Expect(req.URL.EscapedPath()).To(Equal(updateBareMetalServerPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -50607,8 +51341,6 @@ 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 @@ -50617,10 +51349,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"active": true, "attachment_state": "attached", "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "Message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["UserTags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "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", `{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "name": "my-bare-metal-server", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"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"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"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"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}], "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"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"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"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"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "deleting", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "disabled", "supported_modes": ["disabled"]}, "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"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke UpdateVolume successfully with retries`, func() { + It(`Invoke UpdateBareMetalServer successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -50630,37 +51362,34 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the VolumeProfileIdentityByName model - volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) - volumeProfileIdentityModel.Name = core.StringPtr("general-purpose") + // Construct an instance of the BareMetalServerTrustedPlatformModulePatch model + bareMetalServerTrustedPlatformModulePatchModel := new(vpcv1.BareMetalServerTrustedPlatformModulePatch) + bareMetalServerTrustedPlatformModulePatchModel.Mode = core.StringPtr("disabled") - // Construct an instance of the VolumePatch model - volumePatchModel := new(vpcv1.VolumePatch) - volumePatchModel.Capacity = core.Int64Ptr(int64(100)) - volumePatchModel.Iops = core.Int64Ptr(int64(10000)) - volumePatchModel.Name = core.StringPtr("my-volume") - volumePatchModel.Profile = volumeProfileIdentityModel - volumePatchModel.UserTags = []string{"testString"} - volumePatchModelAsPatch, asPatchErr := volumePatchModel.AsPatch() + // Construct an instance of the BareMetalServerPatch model + bareMetalServerPatchModel := new(vpcv1.BareMetalServerPatch) + bareMetalServerPatchModel.EnableSecureBoot = core.BoolPtr(false) + bareMetalServerPatchModel.Name = core.StringPtr("my-bare-metal-server") + bareMetalServerPatchModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePatchModel + bareMetalServerPatchModelAsPatch, asPatchErr := bareMetalServerPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateVolumeOptions model - updateVolumeOptionsModel := new(vpcv1.UpdateVolumeOptions) - updateVolumeOptionsModel.ID = core.StringPtr("testString") - updateVolumeOptionsModel.VolumePatch = volumePatchModelAsPatch - updateVolumeOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateBareMetalServerOptions model + updateBareMetalServerOptionsModel := new(vpcv1.UpdateBareMetalServerOptions) + updateBareMetalServerOptionsModel.ID = core.StringPtr("testString") + updateBareMetalServerOptionsModel.BareMetalServerPatch = bareMetalServerPatchModelAsPatch + updateBareMetalServerOptionsModel.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.UpdateVolumeWithContext(ctx, updateVolumeOptionsModel) + _, _, operationErr := vpcService.UpdateBareMetalServerWithContext(ctx, updateBareMetalServerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateVolume(updateVolumeOptionsModel) + result, response, operationErr := vpcService.UpdateBareMetalServer(updateBareMetalServerOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -50668,7 +51397,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateVolumeWithContext(ctx, updateVolumeOptionsModel) + _, _, operationErr = vpcService.UpdateBareMetalServerWithContext(ctx, updateBareMetalServerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -50682,7 +51411,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateVolumePath)) + Expect(req.URL.EscapedPath()).To(Equal(updateBareMetalServerPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -50701,17 +51430,15 @@ 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", `{"active": true, "attachment_state": "attached", "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "Message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["UserTags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "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", `{"bandwidth": 20000, "boot_target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk"}, "cpu": {"architecture": "amd64", "core_count": 80, "socket_count": 4, "threads_per_core": 2}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::bare-metal-server:1e09281b-f177-46fb-baf1-bc152b2e391a", "disks": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "fcp", "name": "my-bare-metal-server-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "lifecycle_reasons": [{"code": "resource_suspended_by_provider", "message": "The resource has been suspended. Contact IBM support with the CRN for next steps.", "more_info": "https://cloud.ibm.com/apidocs/vpc#resource-suspension"}], "lifecycle_state": "stable", "memory": 1536, "name": "my-bare-metal-server", "network_attachments": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"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"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"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"}}], "network_interfaces": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}], "primary_network_attachment": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/2302-f7a2bf57-af7c-49d9-b599-b2c91293d30c/network_attachments/2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "id": "2302-da8c43ec-b6ca-4bd2-871e-72e288c66ee6", "name": "my-bare-metal-server-network-attachment", "primary_ip": {"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"}, "resource_type": "bare_metal_server_network_attachment", "subnet": {"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"}}, "primary_network_interface": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-server-network-interface", "primary_ip": {"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"}, "resource_type": "network_interface", "subnet": {"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"}}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768", "name": "bx2-metal-192x768", "resource_type": "bare_metal_server_profile"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "bare_metal_server", "status": "deleting", "status_reasons": [{"code": "cannot_start_capacity", "message": "The bare metal server cannot start as there is no more capacity in this\nzone for a bare metal server with the requested profile.", "more_info": "https://console.bluemix.net/docs/iaas/bare_metal_server.html"}], "trusted_platform_module": {"enabled": true, "mode": "disabled", "supported_modes": ["disabled"]}, "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"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke UpdateVolume successfully`, func() { + It(`Invoke UpdateBareMetalServer successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -50721,40 +51448,37 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateVolume(nil) + result, response, operationErr := vpcService.UpdateBareMetalServer(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the VolumeProfileIdentityByName model - volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) - volumeProfileIdentityModel.Name = core.StringPtr("general-purpose") + // Construct an instance of the BareMetalServerTrustedPlatformModulePatch model + bareMetalServerTrustedPlatformModulePatchModel := new(vpcv1.BareMetalServerTrustedPlatformModulePatch) + bareMetalServerTrustedPlatformModulePatchModel.Mode = core.StringPtr("disabled") - // Construct an instance of the VolumePatch model - volumePatchModel := new(vpcv1.VolumePatch) - volumePatchModel.Capacity = core.Int64Ptr(int64(100)) - volumePatchModel.Iops = core.Int64Ptr(int64(10000)) - volumePatchModel.Name = core.StringPtr("my-volume") - volumePatchModel.Profile = volumeProfileIdentityModel - volumePatchModel.UserTags = []string{"testString"} - volumePatchModelAsPatch, asPatchErr := volumePatchModel.AsPatch() + // Construct an instance of the BareMetalServerPatch model + bareMetalServerPatchModel := new(vpcv1.BareMetalServerPatch) + bareMetalServerPatchModel.EnableSecureBoot = core.BoolPtr(false) + bareMetalServerPatchModel.Name = core.StringPtr("my-bare-metal-server") + bareMetalServerPatchModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePatchModel + bareMetalServerPatchModelAsPatch, asPatchErr := bareMetalServerPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateVolumeOptions model - updateVolumeOptionsModel := new(vpcv1.UpdateVolumeOptions) - updateVolumeOptionsModel.ID = core.StringPtr("testString") - updateVolumeOptionsModel.VolumePatch = volumePatchModelAsPatch - updateVolumeOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateBareMetalServerOptions model + updateBareMetalServerOptionsModel := new(vpcv1.UpdateBareMetalServerOptions) + updateBareMetalServerOptionsModel.ID = core.StringPtr("testString") + updateBareMetalServerOptionsModel.BareMetalServerPatch = bareMetalServerPatchModelAsPatch + updateBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateVolume(updateVolumeOptionsModel) + result, response, operationErr = vpcService.UpdateBareMetalServer(updateBareMetalServerOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateVolume with error: Operation validation and request error`, func() { + It(`Invoke UpdateBareMetalServer with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -50763,38 +51487,35 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VolumeProfileIdentityByName model - volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) - volumeProfileIdentityModel.Name = core.StringPtr("general-purpose") + // Construct an instance of the BareMetalServerTrustedPlatformModulePatch model + bareMetalServerTrustedPlatformModulePatchModel := new(vpcv1.BareMetalServerTrustedPlatformModulePatch) + bareMetalServerTrustedPlatformModulePatchModel.Mode = core.StringPtr("disabled") - // Construct an instance of the VolumePatch model - volumePatchModel := new(vpcv1.VolumePatch) - volumePatchModel.Capacity = core.Int64Ptr(int64(100)) - volumePatchModel.Iops = core.Int64Ptr(int64(10000)) - volumePatchModel.Name = core.StringPtr("my-volume") - volumePatchModel.Profile = volumeProfileIdentityModel - volumePatchModel.UserTags = []string{"testString"} - volumePatchModelAsPatch, asPatchErr := volumePatchModel.AsPatch() + // Construct an instance of the BareMetalServerPatch model + bareMetalServerPatchModel := new(vpcv1.BareMetalServerPatch) + bareMetalServerPatchModel.EnableSecureBoot = core.BoolPtr(false) + bareMetalServerPatchModel.Name = core.StringPtr("my-bare-metal-server") + bareMetalServerPatchModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePatchModel + bareMetalServerPatchModelAsPatch, asPatchErr := bareMetalServerPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateVolumeOptions model - updateVolumeOptionsModel := new(vpcv1.UpdateVolumeOptions) - updateVolumeOptionsModel.ID = core.StringPtr("testString") - updateVolumeOptionsModel.VolumePatch = volumePatchModelAsPatch - updateVolumeOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateBareMetalServerOptions model + updateBareMetalServerOptionsModel := new(vpcv1.UpdateBareMetalServerOptions) + updateBareMetalServerOptionsModel.ID = core.StringPtr("testString") + updateBareMetalServerOptionsModel.BareMetalServerPatch = bareMetalServerPatchModelAsPatch + updateBareMetalServerOptionsModel.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.UpdateVolume(updateVolumeOptionsModel) + result, response, operationErr := vpcService.UpdateBareMetalServer(updateBareMetalServerOptionsModel) 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 UpdateVolumeOptions model with no property values - updateVolumeOptionsModelNew := new(vpcv1.UpdateVolumeOptions) + // Construct a second instance of the UpdateBareMetalServerOptions model with no property values + updateBareMetalServerOptionsModelNew := new(vpcv1.UpdateBareMetalServerOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateVolume(updateVolumeOptionsModelNew) + result, response, operationErr = vpcService.UpdateBareMetalServer(updateBareMetalServerOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -50812,7 +51533,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateVolume successfully`, func() { + It(`Invoke UpdateBareMetalServer successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -50821,29 +51542,26 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VolumeProfileIdentityByName model - volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) - volumeProfileIdentityModel.Name = core.StringPtr("general-purpose") + // Construct an instance of the BareMetalServerTrustedPlatformModulePatch model + bareMetalServerTrustedPlatformModulePatchModel := new(vpcv1.BareMetalServerTrustedPlatformModulePatch) + bareMetalServerTrustedPlatformModulePatchModel.Mode = core.StringPtr("disabled") - // Construct an instance of the VolumePatch model - volumePatchModel := new(vpcv1.VolumePatch) - volumePatchModel.Capacity = core.Int64Ptr(int64(100)) - volumePatchModel.Iops = core.Int64Ptr(int64(10000)) - volumePatchModel.Name = core.StringPtr("my-volume") - volumePatchModel.Profile = volumeProfileIdentityModel - volumePatchModel.UserTags = []string{"testString"} - volumePatchModelAsPatch, asPatchErr := volumePatchModel.AsPatch() + // Construct an instance of the BareMetalServerPatch model + bareMetalServerPatchModel := new(vpcv1.BareMetalServerPatch) + bareMetalServerPatchModel.EnableSecureBoot = core.BoolPtr(false) + bareMetalServerPatchModel.Name = core.StringPtr("my-bare-metal-server") + bareMetalServerPatchModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePatchModel + bareMetalServerPatchModelAsPatch, asPatchErr := bareMetalServerPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateVolumeOptions model - updateVolumeOptionsModel := new(vpcv1.UpdateVolumeOptions) - updateVolumeOptionsModel.ID = core.StringPtr("testString") - updateVolumeOptionsModel.VolumePatch = volumePatchModelAsPatch - updateVolumeOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateBareMetalServerOptions model + updateBareMetalServerOptionsModel := new(vpcv1.UpdateBareMetalServerOptions) + updateBareMetalServerOptionsModel.ID = core.StringPtr("testString") + updateBareMetalServerOptionsModel.BareMetalServerPatch = bareMetalServerPatchModelAsPatch + updateBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.UpdateVolume(updateVolumeOptionsModel) + result, response, operationErr := vpcService.UpdateBareMetalServer(updateBareMetalServerOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -50855,31 +51573,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptions *ListSnapshotConsistencyGroupsOptions) - Operation response error`, func() { + Describe(`GetBareMetalServerInitialization(getBareMetalServerInitializationOptions *GetBareMetalServerInitializationOptions) - Operation response error`, func() { version := "testString" - listSnapshotConsistencyGroupsPath := "/snapshot_consistency_groups" + getBareMetalServerInitializationPath := "/bare_metal_servers/testString/initialization" 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(listSnapshotConsistencyGroupsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerInitializationPath)) 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(10))})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) - Expect(req.URL.Query()["backup_policy_plan.id"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListSnapshotConsistencyGroups with error: Operation response processing error`, func() { + It(`Invoke GetBareMetalServerInitialization with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -50888,24 +51600,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListSnapshotConsistencyGroupsOptions model - listSnapshotConsistencyGroupsOptionsModel := new(vpcv1.ListSnapshotConsistencyGroupsOptions) - listSnapshotConsistencyGroupsOptionsModel.Start = core.StringPtr("testString") - listSnapshotConsistencyGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSnapshotConsistencyGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listSnapshotConsistencyGroupsOptionsModel.Name = core.StringPtr("testString") - listSnapshotConsistencyGroupsOptionsModel.Sort = core.StringPtr("name") - listSnapshotConsistencyGroupsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") - listSnapshotConsistencyGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBareMetalServerInitializationOptions model + getBareMetalServerInitializationOptionsModel := new(vpcv1.GetBareMetalServerInitializationOptions) + getBareMetalServerInitializationOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerInitializationOptionsModel.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.ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptionsModel) + result, response, operationErr := vpcService.GetBareMetalServerInitialization(getBareMetalServerInitializationOptionsModel) 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.ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptionsModel) + result, response, operationErr = vpcService.GetBareMetalServerInitialization(getBareMetalServerInitializationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -50915,36 +51622,30 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptions *ListSnapshotConsistencyGroupsOptions)`, func() { + Describe(`GetBareMetalServerInitialization(getBareMetalServerInitializationOptions *GetBareMetalServerInitializationOptions)`, func() { version := "testString" - listSnapshotConsistencyGroupsPath := "/snapshot_consistency_groups" + getBareMetalServerInitializationPath := "/bare_metal_servers/testString/initialization" 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(listSnapshotConsistencyGroupsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerInitializationPath)) 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(10))})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) - Expect(req.URL.Query()["backup_policy_plan.id"]).To(Equal([]string{"testString"})) // 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/snapshot_consistency_groups?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "snapshot_consistency_groups": [{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["ServiceTags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "keys": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/a6b1a881-2ce8-41a3-80fc-36316a73f803", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-key"}], "user_accounts": [{"encrypted_password": "qQ+/YEApnl1ZtEgIrfprzb065307thTkzlnLqL5ICpesdbBN03dyCQ==", "encryption_key": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/a6b1a881-2ce8-41a3-80fc-36316a73f803", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-key"}, "resource_type": "host_user_account", "username": "Administrator"}]}`) })) }) - It(`Invoke ListSnapshotConsistencyGroups successfully with retries`, func() { + It(`Invoke GetBareMetalServerInitialization successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -50954,26 +51655,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListSnapshotConsistencyGroupsOptions model - listSnapshotConsistencyGroupsOptionsModel := new(vpcv1.ListSnapshotConsistencyGroupsOptions) - listSnapshotConsistencyGroupsOptionsModel.Start = core.StringPtr("testString") - listSnapshotConsistencyGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSnapshotConsistencyGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listSnapshotConsistencyGroupsOptionsModel.Name = core.StringPtr("testString") - listSnapshotConsistencyGroupsOptionsModel.Sort = core.StringPtr("name") - listSnapshotConsistencyGroupsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") - listSnapshotConsistencyGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with a Context to test a timeout error + // Construct an instance of the GetBareMetalServerInitializationOptions model + getBareMetalServerInitializationOptionsModel := new(vpcv1.GetBareMetalServerInitializationOptions) + getBareMetalServerInitializationOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerInitializationOptionsModel.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.ListSnapshotConsistencyGroupsWithContext(ctx, listSnapshotConsistencyGroupsOptionsModel) + _, _, operationErr := vpcService.GetBareMetalServerInitializationWithContext(ctx, getBareMetalServerInitializationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptionsModel) + result, response, operationErr := vpcService.GetBareMetalServerInitialization(getBareMetalServerInitializationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -50981,7 +51677,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListSnapshotConsistencyGroupsWithContext(ctx, listSnapshotConsistencyGroupsOptionsModel) + _, _, operationErr = vpcService.GetBareMetalServerInitializationWithContext(ctx, getBareMetalServerInitializationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -50995,24 +51691,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listSnapshotConsistencyGroupsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerInitializationPath)) 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(10))})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) - Expect(req.URL.Query()["backup_policy_plan.id"]).To(Equal([]string{"testString"})) // 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/snapshot_consistency_groups?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "snapshot_consistency_groups": [{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["ServiceTags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "keys": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/a6b1a881-2ce8-41a3-80fc-36316a73f803", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-key"}], "user_accounts": [{"encrypted_password": "qQ+/YEApnl1ZtEgIrfprzb065307thTkzlnLqL5ICpesdbBN03dyCQ==", "encryption_key": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/a6b1a881-2ce8-41a3-80fc-36316a73f803", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-key"}, "resource_type": "host_user_account", "username": "Administrator"}]}`) })) }) - It(`Invoke ListSnapshotConsistencyGroups successfully`, func() { + It(`Invoke GetBareMetalServerInitialization successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -51022,29 +51712,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListSnapshotConsistencyGroups(nil) + result, response, operationErr := vpcService.GetBareMetalServerInitialization(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListSnapshotConsistencyGroupsOptions model - listSnapshotConsistencyGroupsOptionsModel := new(vpcv1.ListSnapshotConsistencyGroupsOptions) - listSnapshotConsistencyGroupsOptionsModel.Start = core.StringPtr("testString") - listSnapshotConsistencyGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSnapshotConsistencyGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listSnapshotConsistencyGroupsOptionsModel.Name = core.StringPtr("testString") - listSnapshotConsistencyGroupsOptionsModel.Sort = core.StringPtr("name") - listSnapshotConsistencyGroupsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") - listSnapshotConsistencyGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBareMetalServerInitializationOptions model + getBareMetalServerInitializationOptionsModel := new(vpcv1.GetBareMetalServerInitializationOptions) + getBareMetalServerInitializationOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerInitializationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptionsModel) + result, response, operationErr = vpcService.GetBareMetalServerInitialization(getBareMetalServerInitializationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListSnapshotConsistencyGroups with error: Operation request error`, func() { + It(`Invoke GetBareMetalServerInitialization with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -51053,23 +51738,25 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListSnapshotConsistencyGroupsOptions model - listSnapshotConsistencyGroupsOptionsModel := new(vpcv1.ListSnapshotConsistencyGroupsOptions) - listSnapshotConsistencyGroupsOptionsModel.Start = core.StringPtr("testString") - listSnapshotConsistencyGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSnapshotConsistencyGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listSnapshotConsistencyGroupsOptionsModel.Name = core.StringPtr("testString") - listSnapshotConsistencyGroupsOptionsModel.Sort = core.StringPtr("name") - listSnapshotConsistencyGroupsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") - listSnapshotConsistencyGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBareMetalServerInitializationOptions model + getBareMetalServerInitializationOptionsModel := new(vpcv1.GetBareMetalServerInitializationOptions) + getBareMetalServerInitializationOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerInitializationOptionsModel.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.ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptionsModel) + result, response, operationErr := vpcService.GetBareMetalServerInitialization(getBareMetalServerInitializationOptionsModel) 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 GetBareMetalServerInitializationOptions model with no property values + getBareMetalServerInitializationOptionsModelNew := new(vpcv1.GetBareMetalServerInitializationOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetBareMetalServerInitialization(getBareMetalServerInitializationOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -51084,7 +51771,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListSnapshotConsistencyGroups successfully`, func() { + It(`Invoke GetBareMetalServerInitialization successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -51093,18 +51780,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListSnapshotConsistencyGroupsOptions model - listSnapshotConsistencyGroupsOptionsModel := new(vpcv1.ListSnapshotConsistencyGroupsOptions) - listSnapshotConsistencyGroupsOptionsModel.Start = core.StringPtr("testString") - listSnapshotConsistencyGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSnapshotConsistencyGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listSnapshotConsistencyGroupsOptionsModel.Name = core.StringPtr("testString") - listSnapshotConsistencyGroupsOptionsModel.Sort = core.StringPtr("name") - listSnapshotConsistencyGroupsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") - listSnapshotConsistencyGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetBareMetalServerInitializationOptions model + getBareMetalServerInitializationOptionsModel := new(vpcv1.GetBareMetalServerInitializationOptions) + getBareMetalServerInitializationOptionsModel.ID = core.StringPtr("testString") + getBareMetalServerInitializationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptionsModel) + result, response, operationErr := vpcService.GetBareMetalServerInitialization(getBareMetalServerInitializationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -51115,59 +51797,98 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) - Context(`Test pagination helper method on response`, func() { - It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.SnapshotConsistencyGroupCollection) - nextObject := new(vpcv1.SnapshotConsistencyGroupCollectionNext) - nextObject.Href = core.StringPtr("ibm.com?start=abc-123") - responseObject.Next = nextObject + }) + Describe(`RestartBareMetalServer(restartBareMetalServerOptions *RestartBareMetalServerOptions)`, func() { + version := "testString" + restartBareMetalServerPath := "/bare_metal_servers/testString/restart" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(Equal(core.StringPtr("abc-123"))) + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(restartBareMetalServerPath)) + 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(204) + })) }) - It(`Invoke GetNextStart without a "Next" property in the response`, func() { - responseObject := new(vpcv1.SnapshotConsistencyGroupCollection) + It(`Invoke RestartBareMetalServer 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()) - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) + // Invoke operation with nil options model (negative test) + response, operationErr := vpcService.RestartBareMetalServer(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the RestartBareMetalServerOptions model + restartBareMetalServerOptionsModel := new(vpcv1.RestartBareMetalServerOptions) + restartBareMetalServerOptionsModel.ID = core.StringPtr("testString") + restartBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.RestartBareMetalServer(restartBareMetalServerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) }) - It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { - responseObject := new(vpcv1.SnapshotConsistencyGroupCollection) - nextObject := new(vpcv1.SnapshotConsistencyGroupCollectionNext) - nextObject.Href = core.StringPtr("ibm.com") - responseObject.Next = nextObject + It(`Invoke RestartBareMetalServer 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()) - value, err := responseObject.GetNextStart() + // Construct an instance of the RestartBareMetalServerOptions model + restartBareMetalServerOptionsModel := new(vpcv1.RestartBareMetalServerOptions) + restartBareMetalServerOptionsModel.ID = core.StringPtr("testString") + restartBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - Expect(value).To(BeNil()) + response, operationErr := vpcService.RestartBareMetalServer(restartBareMetalServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the RestartBareMetalServerOptions model with no property values + restartBareMetalServerOptionsModelNew := new(vpcv1.RestartBareMetalServerOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.RestartBareMetalServer(restartBareMetalServerOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() }) }) - Context(`Using mock server endpoint - paginated response`, func() { + }) + Describe(`StartBareMetalServer(startBareMetalServerOptions *StartBareMetalServerOptions)`, func() { + version := "testString" + startBareMetalServerPath := "/bare_metal_servers/testString/start" + Context(`Using mock server endpoint`, func() { BeforeEach(func() { - var requestNumber int = 0 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(listSnapshotConsistencyGroupsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(startBareMetalServerPath)) + Expect(req.Method).To(Equal("POST")) - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - requestNumber++ - if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"snapshot_consistency_groups":[{"backup_policy_plan":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263","delete_snapshots_on_delete":false,"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263","id":"r134-fa329f6b-0e36-433f-a3bb-0df632e79263","lifecycle_state":"stable","name":"my-snapshot-consistency-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"snapshot_consistency_group","service_tags":["ServiceTags"],"snapshots":[{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}]}],"total_count":2,"limit":1}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"snapshot_consistency_groups":[{"backup_policy_plan":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263","delete_snapshots_on_delete":false,"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263","id":"r134-fa329f6b-0e36-433f-a3bb-0df632e79263","lifecycle_state":"stable","name":"my-snapshot-consistency-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"snapshot_consistency_group","service_tags":["ServiceTags"],"snapshots":[{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}]}],"total_count":2,"limit":1}`) - } else { - res.WriteHeader(400) - } + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) })) }) - It(`Use SnapshotConsistencyGroupsPager.GetNext successfully`, func() { + It(`Invoke StartBareMetalServer successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -51176,28 +51897,87 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listSnapshotConsistencyGroupsOptionsModel := &vpcv1.ListSnapshotConsistencyGroupsOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - Name: core.StringPtr("testString"), - Sort: core.StringPtr("name"), - BackupPolicyPlanID: core.StringPtr("testString"), - } + // Invoke operation with nil options model (negative test) + response, operationErr := vpcService.StartBareMetalServer(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) - pager, err := vpcService.NewSnapshotConsistencyGroupsPager(listSnapshotConsistencyGroupsOptionsModel) + // Construct an instance of the StartBareMetalServerOptions model + startBareMetalServerOptionsModel := new(vpcv1.StartBareMetalServerOptions) + startBareMetalServerOptionsModel.ID = core.StringPtr("testString") + startBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.StartBareMetalServer(startBareMetalServerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke StartBareMetalServer 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 StartBareMetalServerOptions model + startBareMetalServerOptionsModel := new(vpcv1.StartBareMetalServerOptions) + startBareMetalServerOptionsModel.ID = core.StringPtr("testString") + startBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) + response, operationErr := vpcService.StartBareMetalServer(startBareMetalServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the StartBareMetalServerOptions model with no property values + startBareMetalServerOptionsModelNew := new(vpcv1.StartBareMetalServerOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.StartBareMetalServer(startBareMetalServerOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`StopBareMetalServer(stopBareMetalServerOptions *StopBareMetalServerOptions)`, func() { + version := "testString" + stopBareMetalServerPath := "/bare_metal_servers/testString/stop" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() - var allResults []vpcv1.SnapshotConsistencyGroup - for pager.HasNext() { - nextPage, err := pager.GetNext() - Expect(err).To(BeNil()) - Expect(nextPage).ToNot(BeNil()) - allResults = append(allResults, nextPage...) - } - Expect(len(allResults)).To(Equal(2)) + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(stopBareMetalServerPath)) + 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))})) + res.WriteHeader(204) + })) }) - It(`Use SnapshotConsistencyGroupsPager.GetAll successfully`, func() { + It(`Invoke StopBareMetalServer successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -51206,44 +51986,76 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listSnapshotConsistencyGroupsOptionsModel := &vpcv1.ListSnapshotConsistencyGroupsOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - Name: core.StringPtr("testString"), - Sort: core.StringPtr("name"), - BackupPolicyPlanID: core.StringPtr("testString"), - } + // Invoke operation with nil options model (negative test) + response, operationErr := vpcService.StopBareMetalServer(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) - pager, err := vpcService.NewSnapshotConsistencyGroupsPager(listSnapshotConsistencyGroupsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) + // Construct an instance of the StopBareMetalServerOptions model + stopBareMetalServerOptionsModel := new(vpcv1.StopBareMetalServerOptions) + stopBareMetalServerOptionsModel.ID = core.StringPtr("testString") + stopBareMetalServerOptionsModel.Type = core.StringPtr("hard") + stopBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - allResults, err := pager.GetAll() + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.StopBareMetalServer(stopBareMetalServerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke StopBareMetalServer 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 StopBareMetalServerOptions model + stopBareMetalServerOptionsModel := new(vpcv1.StopBareMetalServerOptions) + stopBareMetalServerOptionsModel.ID = core.StringPtr("testString") + stopBareMetalServerOptionsModel.Type = core.StringPtr("hard") + stopBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - Expect(allResults).ToNot(BeNil()) - Expect(len(allResults)).To(Equal(2)) + response, operationErr := vpcService.StopBareMetalServer(stopBareMetalServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the StopBareMetalServerOptions model with no property values + stopBareMetalServerOptionsModelNew := new(vpcv1.StopBareMetalServerOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.StopBareMetalServer(stopBareMetalServerOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() }) }) }) - Describe(`CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptions *CreateSnapshotConsistencyGroupOptions) - Operation response error`, func() { + Describe(`ListVolumeProfiles(listVolumeProfilesOptions *ListVolumeProfilesOptions) - Operation response error`, func() { version := "testString" - createSnapshotConsistencyGroupPath := "/snapshot_consistency_groups" + listVolumeProfilesPath := "/volume/profiles" 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(createSnapshotConsistencyGroupPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(listVolumeProfilesPath)) + 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(10))})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateSnapshotConsistencyGroup with error: Operation response processing error`, func() { + It(`Invoke ListVolumeProfiles with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -51252,40 +52064,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the VolumeIdentityByID model - volumeIdentityModel := new(vpcv1.VolumeIdentityByID) - volumeIdentityModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - - // Construct an instance of the SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem model - snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel := new(vpcv1.SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem) - snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel.Name = core.StringPtr("my-snapshot") - snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel.SourceVolume = volumeIdentityModel - snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel.UserTags = []string{"testString"} - - // Construct an instance of the SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots model - snapshotConsistencyGroupPrototypeModel := new(vpcv1.SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots) - snapshotConsistencyGroupPrototypeModel.DeleteSnapshotsOnDelete = core.BoolPtr(true) - snapshotConsistencyGroupPrototypeModel.Name = core.StringPtr("my-snapshot-consistency-group") - snapshotConsistencyGroupPrototypeModel.ResourceGroup = resourceGroupIdentityModel - snapshotConsistencyGroupPrototypeModel.Snapshots = []vpcv1.SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem{*snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel} - - // Construct an instance of the CreateSnapshotConsistencyGroupOptions model - createSnapshotConsistencyGroupOptionsModel := new(vpcv1.CreateSnapshotConsistencyGroupOptions) - createSnapshotConsistencyGroupOptionsModel.SnapshotConsistencyGroupPrototype = snapshotConsistencyGroupPrototypeModel - createSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListVolumeProfilesOptions model + listVolumeProfilesOptionsModel := new(vpcv1.ListVolumeProfilesOptions) + listVolumeProfilesOptionsModel.Start = core.StringPtr("testString") + listVolumeProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listVolumeProfilesOptionsModel.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.CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptionsModel) + result, response, operationErr := vpcService.ListVolumeProfiles(listVolumeProfilesOptionsModel) 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.CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptionsModel) + result, response, operationErr = vpcService.ListVolumeProfiles(listVolumeProfilesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -51295,46 +52087,32 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptions *CreateSnapshotConsistencyGroupOptions)`, func() { + Describe(`ListVolumeProfiles(listVolumeProfilesOptions *ListVolumeProfilesOptions)`, func() { version := "testString" - createSnapshotConsistencyGroupPath := "/snapshot_consistency_groups" + listVolumeProfilesPath := "/volume/profiles" 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(createSnapshotConsistencyGroupPath)) - 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.EscapedPath()).To(Equal(listVolumeProfilesPath)) + 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(10))})) // 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", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["ServiceTags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "profiles": [{"family": "tiered", "href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}], "total_count": 132}`) })) }) - It(`Invoke CreateSnapshotConsistencyGroup successfully with retries`, func() { + It(`Invoke ListVolumeProfiles successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -51344,42 +52122,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the VolumeIdentityByID model - volumeIdentityModel := new(vpcv1.VolumeIdentityByID) - volumeIdentityModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - - // Construct an instance of the SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem model - snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel := new(vpcv1.SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem) - snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel.Name = core.StringPtr("my-snapshot") - snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel.SourceVolume = volumeIdentityModel - snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel.UserTags = []string{"testString"} - - // Construct an instance of the SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots model - snapshotConsistencyGroupPrototypeModel := new(vpcv1.SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots) - snapshotConsistencyGroupPrototypeModel.DeleteSnapshotsOnDelete = core.BoolPtr(true) - snapshotConsistencyGroupPrototypeModel.Name = core.StringPtr("my-snapshot-consistency-group") - snapshotConsistencyGroupPrototypeModel.ResourceGroup = resourceGroupIdentityModel - snapshotConsistencyGroupPrototypeModel.Snapshots = []vpcv1.SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem{*snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel} - - // Construct an instance of the CreateSnapshotConsistencyGroupOptions model - createSnapshotConsistencyGroupOptionsModel := new(vpcv1.CreateSnapshotConsistencyGroupOptions) - createSnapshotConsistencyGroupOptionsModel.SnapshotConsistencyGroupPrototype = snapshotConsistencyGroupPrototypeModel - createSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListVolumeProfilesOptions model + listVolumeProfilesOptionsModel := new(vpcv1.ListVolumeProfilesOptions) + listVolumeProfilesOptionsModel.Start = core.StringPtr("testString") + listVolumeProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listVolumeProfilesOptionsModel.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.CreateSnapshotConsistencyGroupWithContext(ctx, createSnapshotConsistencyGroupOptionsModel) + _, _, operationErr := vpcService.ListVolumeProfilesWithContext(ctx, listVolumeProfilesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptionsModel) + result, response, operationErr := vpcService.ListVolumeProfiles(listVolumeProfilesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -51387,7 +52145,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreateSnapshotConsistencyGroupWithContext(ctx, createSnapshotConsistencyGroupOptionsModel) + _, _, operationErr = vpcService.ListVolumeProfilesWithContext(ctx, listVolumeProfilesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -51401,34 +52159,20 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createSnapshotConsistencyGroupPath)) - 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.EscapedPath()).To(Equal(listVolumeProfilesPath)) + 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(10))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["ServiceTags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "profiles": [{"family": "tiered", "href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}], "total_count": 132}`) })) }) - It(`Invoke CreateSnapshotConsistencyGroup successfully`, func() { + It(`Invoke ListVolumeProfiles successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -51438,45 +52182,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreateSnapshotConsistencyGroup(nil) + result, response, operationErr := vpcService.ListVolumeProfiles(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + // Construct an instance of the ListVolumeProfilesOptions model + listVolumeProfilesOptionsModel := new(vpcv1.ListVolumeProfilesOptions) + listVolumeProfilesOptionsModel.Start = core.StringPtr("testString") + listVolumeProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listVolumeProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Construct an instance of the VolumeIdentityByID model - volumeIdentityModel := new(vpcv1.VolumeIdentityByID) - volumeIdentityModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - - // Construct an instance of the SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem model - snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel := new(vpcv1.SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem) - snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel.Name = core.StringPtr("my-snapshot") - snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel.SourceVolume = volumeIdentityModel - snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel.UserTags = []string{"testString"} - - // Construct an instance of the SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots model - snapshotConsistencyGroupPrototypeModel := new(vpcv1.SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots) - snapshotConsistencyGroupPrototypeModel.DeleteSnapshotsOnDelete = core.BoolPtr(true) - snapshotConsistencyGroupPrototypeModel.Name = core.StringPtr("my-snapshot-consistency-group") - snapshotConsistencyGroupPrototypeModel.ResourceGroup = resourceGroupIdentityModel - snapshotConsistencyGroupPrototypeModel.Snapshots = []vpcv1.SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem{*snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel} - - // Construct an instance of the CreateSnapshotConsistencyGroupOptions model - createSnapshotConsistencyGroupOptionsModel := new(vpcv1.CreateSnapshotConsistencyGroupOptions) - createSnapshotConsistencyGroupOptionsModel.SnapshotConsistencyGroupPrototype = snapshotConsistencyGroupPrototypeModel - createSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListVolumeProfiles(listVolumeProfilesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateSnapshotConsistencyGroup with error: Operation validation and request error`, func() { + It(`Invoke ListVolumeProfiles with error: Operation request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -51485,46 +52209,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the VolumeIdentityByID model - volumeIdentityModel := new(vpcv1.VolumeIdentityByID) - volumeIdentityModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - - // Construct an instance of the SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem model - snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel := new(vpcv1.SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem) - snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel.Name = core.StringPtr("my-snapshot") - snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel.SourceVolume = volumeIdentityModel - snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel.UserTags = []string{"testString"} - - // Construct an instance of the SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots model - snapshotConsistencyGroupPrototypeModel := new(vpcv1.SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots) - snapshotConsistencyGroupPrototypeModel.DeleteSnapshotsOnDelete = core.BoolPtr(true) - snapshotConsistencyGroupPrototypeModel.Name = core.StringPtr("my-snapshot-consistency-group") - snapshotConsistencyGroupPrototypeModel.ResourceGroup = resourceGroupIdentityModel - snapshotConsistencyGroupPrototypeModel.Snapshots = []vpcv1.SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem{*snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel} - - // Construct an instance of the CreateSnapshotConsistencyGroupOptions model - createSnapshotConsistencyGroupOptionsModel := new(vpcv1.CreateSnapshotConsistencyGroupOptions) - createSnapshotConsistencyGroupOptionsModel.SnapshotConsistencyGroupPrototype = snapshotConsistencyGroupPrototypeModel - createSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListVolumeProfilesOptions model + listVolumeProfilesOptionsModel := new(vpcv1.ListVolumeProfilesOptions) + listVolumeProfilesOptionsModel.Start = core.StringPtr("testString") + listVolumeProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listVolumeProfilesOptionsModel.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.CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptionsModel) + result, response, operationErr := vpcService.ListVolumeProfiles(listVolumeProfilesOptionsModel) 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 CreateSnapshotConsistencyGroupOptions model with no property values - createSnapshotConsistencyGroupOptionsModelNew := new(vpcv1.CreateSnapshotConsistencyGroupOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -51536,10 +52233,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke CreateSnapshotConsistencyGroup successfully`, func() { + It(`Invoke ListVolumeProfiles successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -51548,34 +52245,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the VolumeIdentityByID model - volumeIdentityModel := new(vpcv1.VolumeIdentityByID) - volumeIdentityModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - - // Construct an instance of the SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem model - snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel := new(vpcv1.SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem) - snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel.Name = core.StringPtr("my-snapshot") - snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel.SourceVolume = volumeIdentityModel - snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel.UserTags = []string{"testString"} - - // Construct an instance of the SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots model - snapshotConsistencyGroupPrototypeModel := new(vpcv1.SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots) - snapshotConsistencyGroupPrototypeModel.DeleteSnapshotsOnDelete = core.BoolPtr(true) - snapshotConsistencyGroupPrototypeModel.Name = core.StringPtr("my-snapshot-consistency-group") - snapshotConsistencyGroupPrototypeModel.ResourceGroup = resourceGroupIdentityModel - snapshotConsistencyGroupPrototypeModel.Snapshots = []vpcv1.SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem{*snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel} - - // Construct an instance of the CreateSnapshotConsistencyGroupOptions model - createSnapshotConsistencyGroupOptionsModel := new(vpcv1.CreateSnapshotConsistencyGroupOptions) - createSnapshotConsistencyGroupOptionsModel.SnapshotConsistencyGroupPrototype = snapshotConsistencyGroupPrototypeModel - createSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListVolumeProfilesOptions model + listVolumeProfilesOptionsModel := new(vpcv1.ListVolumeProfilesOptions) + listVolumeProfilesOptionsModel.Start = core.StringPtr("testString") + listVolumeProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listVolumeProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptionsModel) + result, response, operationErr := vpcService.ListVolumeProfiles(listVolumeProfilesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -51586,26 +52263,127 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(vpcv1.VolumeProfileCollection) + nextObject := new(vpcv1.VolumeProfileCollectionNext) + 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.VolumeProfileCollection) + + 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.VolumeProfileCollection) + nextObject := new(vpcv1.VolumeProfileCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { + BeforeEach(func() { + var requestNumber int = 0 + 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(listVolumeProfilesPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"profiles":[{"family":"tiered","href":"https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose","name":"general-purpose"}]}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"profiles":[{"family":"tiered","href":"https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose","name":"general-purpose"}]}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use VolumeProfilesPager.GetNext 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()) + + listVolumeProfilesOptionsModel := &vpcv1.ListVolumeProfilesOptions{ + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewVolumeProfilesPager(listVolumeProfilesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.VolumeProfile + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) + }) + It(`Use VolumeProfilesPager.GetAll 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()) + + listVolumeProfilesOptionsModel := &vpcv1.ListVolumeProfilesOptions{ + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewVolumeProfilesPager(listVolumeProfilesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) + }) + }) }) - Describe(`DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptions *DeleteSnapshotConsistencyGroupOptions) - Operation response error`, func() { + Describe(`GetVolumeProfile(getVolumeProfileOptions *GetVolumeProfileOptions) - Operation response error`, func() { version := "testString" - deleteSnapshotConsistencyGroupPath := "/snapshot_consistency_groups/testString" + getVolumeProfilePath := "/volume/profiles/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(deleteSnapshotConsistencyGroupPath)) - Expect(req.Method).To(Equal("DELETE")) + Expect(req.URL.EscapedPath()).To(Equal(getVolumeProfilePath)) + 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(202) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke DeleteSnapshotConsistencyGroup with error: Operation response processing error`, func() { + It(`Invoke GetVolumeProfile with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -51614,19 +52392,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteSnapshotConsistencyGroupOptions model - deleteSnapshotConsistencyGroupOptionsModel := new(vpcv1.DeleteSnapshotConsistencyGroupOptions) - deleteSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") - deleteSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetVolumeProfileOptions model + getVolumeProfileOptionsModel := new(vpcv1.GetVolumeProfileOptions) + getVolumeProfileOptionsModel.Name = core.StringPtr("testString") + getVolumeProfileOptionsModel.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.DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptionsModel) + result, response, operationErr := vpcService.GetVolumeProfile(getVolumeProfileOptionsModel) 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.DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptionsModel) + result, response, operationErr = vpcService.GetVolumeProfile(getVolumeProfileOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -51636,17 +52414,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptions *DeleteSnapshotConsistencyGroupOptions)`, func() { + Describe(`GetVolumeProfile(getVolumeProfileOptions *GetVolumeProfileOptions)`, func() { version := "testString" - deleteSnapshotConsistencyGroupPath := "/snapshot_consistency_groups/testString" + getVolumeProfilePath := "/volume/profiles/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(deleteSnapshotConsistencyGroupPath)) - Expect(req.Method).To(Equal("DELETE")) + Expect(req.URL.EscapedPath()).To(Equal(getVolumeProfilePath)) + 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))})) @@ -51655,11 +52433,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) - fmt.Fprintf(res, "%s", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["ServiceTags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"family": "tiered", "href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}`) })) }) - It(`Invoke DeleteSnapshotConsistencyGroup successfully with retries`, func() { + It(`Invoke GetVolumeProfile successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -51669,21 +52447,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the DeleteSnapshotConsistencyGroupOptions model - deleteSnapshotConsistencyGroupOptionsModel := new(vpcv1.DeleteSnapshotConsistencyGroupOptions) - deleteSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") - deleteSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetVolumeProfileOptions model + getVolumeProfileOptionsModel := new(vpcv1.GetVolumeProfileOptions) + getVolumeProfileOptionsModel.Name = core.StringPtr("testString") + getVolumeProfileOptionsModel.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.DeleteSnapshotConsistencyGroupWithContext(ctx, deleteSnapshotConsistencyGroupOptionsModel) + _, _, operationErr := vpcService.GetVolumeProfileWithContext(ctx, getVolumeProfileOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptionsModel) + result, response, operationErr := vpcService.GetVolumeProfile(getVolumeProfileOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -51691,7 +52469,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.DeleteSnapshotConsistencyGroupWithContext(ctx, deleteSnapshotConsistencyGroupOptionsModel) + _, _, operationErr = vpcService.GetVolumeProfileWithContext(ctx, getVolumeProfileOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -51705,18 +52483,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteSnapshotConsistencyGroupPath)) - Expect(req.Method).To(Equal("DELETE")) + Expect(req.URL.EscapedPath()).To(Equal(getVolumeProfilePath)) + 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(202) - fmt.Fprintf(res, "%s", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["ServiceTags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"family": "tiered", "href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}`) })) }) - It(`Invoke DeleteSnapshotConsistencyGroup successfully`, func() { + It(`Invoke GetVolumeProfile successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -51726,24 +52504,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.DeleteSnapshotConsistencyGroup(nil) + result, response, operationErr := vpcService.GetVolumeProfile(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the DeleteSnapshotConsistencyGroupOptions model - deleteSnapshotConsistencyGroupOptionsModel := new(vpcv1.DeleteSnapshotConsistencyGroupOptions) - deleteSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") - deleteSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetVolumeProfileOptions model + getVolumeProfileOptionsModel := new(vpcv1.GetVolumeProfileOptions) + getVolumeProfileOptionsModel.Name = core.StringPtr("testString") + getVolumeProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptionsModel) + result, response, operationErr = vpcService.GetVolumeProfile(getVolumeProfileOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke DeleteSnapshotConsistencyGroup with error: Operation validation and request error`, func() { + It(`Invoke GetVolumeProfile with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -51752,22 +52530,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteSnapshotConsistencyGroupOptions model - deleteSnapshotConsistencyGroupOptionsModel := new(vpcv1.DeleteSnapshotConsistencyGroupOptions) - deleteSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") - deleteSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetVolumeProfileOptions model + getVolumeProfileOptionsModel := new(vpcv1.GetVolumeProfileOptions) + getVolumeProfileOptionsModel.Name = core.StringPtr("testString") + getVolumeProfileOptionsModel.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.DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptionsModel) + result, response, operationErr := vpcService.GetVolumeProfile(getVolumeProfileOptionsModel) 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 DeleteSnapshotConsistencyGroupOptions model with no property values - deleteSnapshotConsistencyGroupOptionsModelNew := new(vpcv1.DeleteSnapshotConsistencyGroupOptions) + // Construct a second instance of the GetVolumeProfileOptions model with no property values + getVolumeProfileOptionsModelNew := new(vpcv1.GetVolumeProfileOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptionsModelNew) + result, response, operationErr = vpcService.GetVolumeProfile(getVolumeProfileOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -51782,10 +52560,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(202) + res.WriteHeader(200) })) }) - It(`Invoke DeleteSnapshotConsistencyGroup successfully`, func() { + It(`Invoke GetVolumeProfile successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -51794,13 +52572,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteSnapshotConsistencyGroupOptions model - deleteSnapshotConsistencyGroupOptionsModel := new(vpcv1.DeleteSnapshotConsistencyGroupOptions) - deleteSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") - deleteSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetVolumeProfileOptions model + getVolumeProfileOptionsModel := new(vpcv1.GetVolumeProfileOptions) + getVolumeProfileOptionsModel.Name = core.StringPtr("testString") + getVolumeProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptionsModel) + result, response, operationErr := vpcService.GetVolumeProfile(getVolumeProfileOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -51812,25 +52590,33 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptions *GetSnapshotConsistencyGroupOptions) - Operation response error`, func() { + Describe(`ListVolumes(listVolumesOptions *ListVolumesOptions) - Operation response error`, func() { version := "testString" - getSnapshotConsistencyGroupPath := "/snapshot_consistency_groups/testString" + listVolumesPath := "/volumes" 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(getSnapshotConsistencyGroupPath)) + Expect(req.URL.EscapedPath()).To(Equal(listVolumesPath)) 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(10))})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["attachment_state"]).To(Equal([]string{"attached"})) + Expect(req.URL.Query()["encryption"]).To(Equal([]string{"provider_managed"})) + Expect(req.URL.Query()["operating_system.family"]).To(Equal([]string{"Ubuntu Server"})) + Expect(req.URL.Query()["operating_system.architecture"]).To(Equal([]string{"amd64"})) + Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"us-south-1"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetSnapshotConsistencyGroup with error: Operation response processing error`, func() { + It(`Invoke ListVolumes with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -51839,19 +52625,26 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetSnapshotConsistencyGroupOptions model - getSnapshotConsistencyGroupOptionsModel := new(vpcv1.GetSnapshotConsistencyGroupOptions) - getSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") - getSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListVolumesOptions model + listVolumesOptionsModel := new(vpcv1.ListVolumesOptions) + listVolumesOptionsModel.Start = core.StringPtr("testString") + listVolumesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listVolumesOptionsModel.Name = core.StringPtr("testString") + listVolumesOptionsModel.AttachmentState = core.StringPtr("attached") + listVolumesOptionsModel.Encryption = core.StringPtr("provider_managed") + listVolumesOptionsModel.OperatingSystemFamily = core.StringPtr("Ubuntu Server") + listVolumesOptionsModel.OperatingSystemArchitecture = core.StringPtr("amd64") + listVolumesOptionsModel.ZoneName = core.StringPtr("us-south-1") + listVolumesOptionsModel.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.GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptionsModel) + result, response, operationErr := vpcService.ListVolumes(listVolumesOptionsModel) 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.GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptionsModel) + result, response, operationErr = vpcService.ListVolumes(listVolumesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -51861,30 +52654,38 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptions *GetSnapshotConsistencyGroupOptions)`, func() { + Describe(`ListVolumes(listVolumesOptions *ListVolumesOptions)`, func() { version := "testString" - getSnapshotConsistencyGroupPath := "/snapshot_consistency_groups/testString" + listVolumesPath := "/volumes" 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(getSnapshotConsistencyGroupPath)) + Expect(req.URL.EscapedPath()).To(Equal(listVolumesPath)) 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(10))})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["attachment_state"]).To(Equal([]string{"attached"})) + Expect(req.URL.Query()["encryption"]).To(Equal([]string{"provider_managed"})) + Expect(req.URL.Query()["operating_system.family"]).To(Equal([]string{"Ubuntu Server"})) + Expect(req.URL.Query()["operating_system.architecture"]).To(Equal([]string{"amd64"})) + Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"us-south-1"})) // 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", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["ServiceTags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volumes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volumes?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132, "volumes": [{"active": true, "attachment_state": "attached", "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "Message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["UserTags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}]}`) })) }) - It(`Invoke GetSnapshotConsistencyGroup successfully with retries`, func() { + It(`Invoke ListVolumes successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -51894,21 +52695,28 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetSnapshotConsistencyGroupOptions model - getSnapshotConsistencyGroupOptionsModel := new(vpcv1.GetSnapshotConsistencyGroupOptions) - getSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") - getSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListVolumesOptions model + listVolumesOptionsModel := new(vpcv1.ListVolumesOptions) + listVolumesOptionsModel.Start = core.StringPtr("testString") + listVolumesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listVolumesOptionsModel.Name = core.StringPtr("testString") + listVolumesOptionsModel.AttachmentState = core.StringPtr("attached") + listVolumesOptionsModel.Encryption = core.StringPtr("provider_managed") + listVolumesOptionsModel.OperatingSystemFamily = core.StringPtr("Ubuntu Server") + listVolumesOptionsModel.OperatingSystemArchitecture = core.StringPtr("amd64") + listVolumesOptionsModel.ZoneName = core.StringPtr("us-south-1") + listVolumesOptionsModel.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.GetSnapshotConsistencyGroupWithContext(ctx, getSnapshotConsistencyGroupOptionsModel) + _, _, operationErr := vpcService.ListVolumesWithContext(ctx, listVolumesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptionsModel) + result, response, operationErr := vpcService.ListVolumes(listVolumesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -51916,7 +52724,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetSnapshotConsistencyGroupWithContext(ctx, getSnapshotConsistencyGroupOptionsModel) + _, _, operationErr = vpcService.ListVolumesWithContext(ctx, listVolumesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -51930,18 +52738,26 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSnapshotConsistencyGroupPath)) + Expect(req.URL.EscapedPath()).To(Equal(listVolumesPath)) 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(10))})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["attachment_state"]).To(Equal([]string{"attached"})) + Expect(req.URL.Query()["encryption"]).To(Equal([]string{"provider_managed"})) + Expect(req.URL.Query()["operating_system.family"]).To(Equal([]string{"Ubuntu Server"})) + Expect(req.URL.Query()["operating_system.architecture"]).To(Equal([]string{"amd64"})) + Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"us-south-1"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["ServiceTags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volumes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volumes?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132, "volumes": [{"active": true, "attachment_state": "attached", "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "Message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["UserTags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}]}`) })) }) - It(`Invoke GetSnapshotConsistencyGroup successfully`, func() { + It(`Invoke ListVolumes successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -51951,24 +52767,31 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetSnapshotConsistencyGroup(nil) + result, response, operationErr := vpcService.ListVolumes(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetSnapshotConsistencyGroupOptions model - getSnapshotConsistencyGroupOptionsModel := new(vpcv1.GetSnapshotConsistencyGroupOptions) - getSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") - getSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListVolumesOptions model + listVolumesOptionsModel := new(vpcv1.ListVolumesOptions) + listVolumesOptionsModel.Start = core.StringPtr("testString") + listVolumesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listVolumesOptionsModel.Name = core.StringPtr("testString") + listVolumesOptionsModel.AttachmentState = core.StringPtr("attached") + listVolumesOptionsModel.Encryption = core.StringPtr("provider_managed") + listVolumesOptionsModel.OperatingSystemFamily = core.StringPtr("Ubuntu Server") + listVolumesOptionsModel.OperatingSystemArchitecture = core.StringPtr("amd64") + listVolumesOptionsModel.ZoneName = core.StringPtr("us-south-1") + listVolumesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptionsModel) + result, response, operationErr = vpcService.ListVolumes(listVolumesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetSnapshotConsistencyGroup with error: Operation validation and request error`, func() { + It(`Invoke ListVolumes with error: Operation request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -51977,25 +52800,25 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetSnapshotConsistencyGroupOptions model - getSnapshotConsistencyGroupOptionsModel := new(vpcv1.GetSnapshotConsistencyGroupOptions) - getSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") - getSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListVolumesOptions model + listVolumesOptionsModel := new(vpcv1.ListVolumesOptions) + listVolumesOptionsModel.Start = core.StringPtr("testString") + listVolumesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listVolumesOptionsModel.Name = core.StringPtr("testString") + listVolumesOptionsModel.AttachmentState = core.StringPtr("attached") + listVolumesOptionsModel.Encryption = core.StringPtr("provider_managed") + listVolumesOptionsModel.OperatingSystemFamily = core.StringPtr("Ubuntu Server") + listVolumesOptionsModel.OperatingSystemArchitecture = core.StringPtr("amd64") + listVolumesOptionsModel.ZoneName = core.StringPtr("us-south-1") + listVolumesOptionsModel.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.GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptionsModel) + result, response, operationErr := vpcService.ListVolumes(listVolumesOptionsModel) 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 GetSnapshotConsistencyGroupOptions model with no property values - getSnapshotConsistencyGroupOptionsModelNew := new(vpcv1.GetSnapshotConsistencyGroupOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -52010,7 +52833,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetSnapshotConsistencyGroup successfully`, func() { + It(`Invoke ListVolumes successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -52019,13 +52842,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetSnapshotConsistencyGroupOptions model - getSnapshotConsistencyGroupOptionsModel := new(vpcv1.GetSnapshotConsistencyGroupOptions) - getSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") - getSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListVolumesOptions model + listVolumesOptionsModel := new(vpcv1.ListVolumesOptions) + listVolumesOptionsModel.Start = core.StringPtr("testString") + listVolumesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listVolumesOptionsModel.Name = core.StringPtr("testString") + listVolumesOptionsModel.AttachmentState = core.StringPtr("attached") + listVolumesOptionsModel.Encryption = core.StringPtr("provider_managed") + listVolumesOptionsModel.OperatingSystemFamily = core.StringPtr("Ubuntu Server") + listVolumesOptionsModel.OperatingSystemArchitecture = core.StringPtr("amd64") + listVolumesOptionsModel.ZoneName = core.StringPtr("us-south-1") + listVolumesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptionsModel) + result, response, operationErr := vpcService.ListVolumes(listVolumesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -52036,28 +52866,59 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) - }) - Describe(`UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptions *UpdateSnapshotConsistencyGroupOptions) - Operation response error`, func() { - version := "testString" - updateSnapshotConsistencyGroupPath := "/snapshot_consistency_groups/testString" - Context(`Using mock server endpoint with invalid JSON response`, func() { + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(vpcv1.VolumeCollection) + nextObject := new(vpcv1.VolumeCollectionNext) + 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.VolumeCollection) + + 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.VolumeCollection) + nextObject := new(vpcv1.VolumeCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { BeforeEach(func() { + var requestNumber int = 0 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(updateSnapshotConsistencyGroupPath)) - 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))})) + Expect(req.URL.EscapedPath()).To(Equal(listVolumesPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprint(res, `} this is not valid json {`) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"volumes":[{"active":true,"attachment_state":"attached","bandwidth":1000,"busy":true,"capacity":1000,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5","encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"health_reasons":[{"code":"initializing_from_snapshot","message":"Performance will be degraded while this volume is being initialized from its snapshot","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","iops":10000,"name":"my-volume","operating_system":{"architecture":"amd64","dedicated_host_only":false,"display_name":"Ubuntu Server 16.04 LTS amd64","family":"Ubuntu Server","href":"https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64","name":"ubuntu-16-amd64","vendor":"Canonical","version":"16.04 LTS"},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose","name":"general-purpose"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"volume","source_image":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"aa2432b1fa4d4ace891e9b80fc104e34","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"},"status":"available","status_reasons":[{"code":"encryption_key_deleted","message":"Message","more_info":"https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}],"user_tags":["UserTags"],"volume_attachments":[{"delete_volume_on_instance_delete":true,"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"device":{"id":"80b3e36e-41f4-40e9-bd56-beae81792a68"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"82cbf856-9cbb-45fb-b62f-d7bcef32399a","instance":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance"},"name":"my-volume-attachment","type":"boot"}],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}]}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"volumes":[{"active":true,"attachment_state":"attached","bandwidth":1000,"busy":true,"capacity":1000,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5","encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"health_reasons":[{"code":"initializing_from_snapshot","message":"Performance will be degraded while this volume is being initialized from its snapshot","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}],"health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","iops":10000,"name":"my-volume","operating_system":{"architecture":"amd64","dedicated_host_only":false,"display_name":"Ubuntu Server 16.04 LTS amd64","family":"Ubuntu Server","href":"https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64","name":"ubuntu-16-amd64","vendor":"Canonical","version":"16.04 LTS"},"profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose","name":"general-purpose"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"volume","source_image":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"aa2432b1fa4d4ace891e9b80fc104e34","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"},"status":"available","status_reasons":[{"code":"encryption_key_deleted","message":"Message","more_info":"https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}],"user_tags":["UserTags"],"volume_attachments":[{"delete_volume_on_instance_delete":true,"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"device":{"id":"80b3e36e-41f4-40e9-bd56-beae81792a68"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"82cbf856-9cbb-45fb-b62f-d7bcef32399a","instance":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance"},"name":"my-volume-attachment","type":"boot"}],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}]}`) + } else { + res.WriteHeader(400) + } })) }) - It(`Invoke UpdateSnapshotConsistencyGroup with error: Operation response processing error`, func() { + It(`Use VolumesPager.GetNext successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -52066,28 +52927,126 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the SnapshotConsistencyGroupPatch model - snapshotConsistencyGroupPatchModel := new(vpcv1.SnapshotConsistencyGroupPatch) - snapshotConsistencyGroupPatchModel.DeleteSnapshotsOnDelete = core.BoolPtr(true) - snapshotConsistencyGroupPatchModel.Name = core.StringPtr("my-snapshot-consistency-group") - snapshotConsistencyGroupPatchModelAsPatch, asPatchErr := snapshotConsistencyGroupPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + listVolumesOptionsModel := &vpcv1.ListVolumesOptions{ + Limit: core.Int64Ptr(int64(10)), + Name: core.StringPtr("testString"), + AttachmentState: core.StringPtr("attached"), + Encryption: core.StringPtr("provider_managed"), + OperatingSystemFamily: core.StringPtr("Ubuntu Server"), + OperatingSystemArchitecture: core.StringPtr("amd64"), + ZoneName: core.StringPtr("us-south-1"), + } - // Construct an instance of the UpdateSnapshotConsistencyGroupOptions model - updateSnapshotConsistencyGroupOptionsModel := new(vpcv1.UpdateSnapshotConsistencyGroupOptions) - updateSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") - updateSnapshotConsistencyGroupOptionsModel.SnapshotConsistencyGroupPatch = snapshotConsistencyGroupPatchModelAsPatch - updateSnapshotConsistencyGroupOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + pager, err := vpcService.NewVolumesPager(listVolumesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.Volume + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) + }) + It(`Use VolumesPager.GetAll 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()) + + listVolumesOptionsModel := &vpcv1.ListVolumesOptions{ + Limit: core.Int64Ptr(int64(10)), + Name: core.StringPtr("testString"), + AttachmentState: core.StringPtr("attached"), + Encryption: core.StringPtr("provider_managed"), + OperatingSystemFamily: core.StringPtr("Ubuntu Server"), + OperatingSystemArchitecture: core.StringPtr("amd64"), + ZoneName: core.StringPtr("us-south-1"), + } + + pager, err := vpcService.NewVolumesPager(listVolumesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) + }) + }) + }) + Describe(`CreateVolume(createVolumeOptions *CreateVolumeOptions) - Operation response error`, func() { + version := "testString" + createVolumePath := "/volumes" + 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(createVolumePath)) + 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 CreateVolume 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 VolumeProfileIdentityByName model + volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) + volumeProfileIdentityModel.Name = core.StringPtr("5iops-tier") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the VolumePrototypeVolumeByCapacity model + volumePrototypeModel := new(vpcv1.VolumePrototypeVolumeByCapacity) + volumePrototypeModel.Iops = core.Int64Ptr(int64(10000)) + volumePrototypeModel.Name = core.StringPtr("my-volume") + volumePrototypeModel.Profile = volumeProfileIdentityModel + volumePrototypeModel.ResourceGroup = resourceGroupIdentityModel + volumePrototypeModel.UserTags = []string{} + volumePrototypeModel.Zone = zoneIdentityModel + volumePrototypeModel.Capacity = core.Int64Ptr(int64(100)) + volumePrototypeModel.EncryptionKey = encryptionKeyIdentityModel + + // Construct an instance of the CreateVolumeOptions model + createVolumeOptionsModel := new(vpcv1.CreateVolumeOptions) + createVolumeOptionsModel.VolumePrototype = volumePrototypeModel + createVolumeOptionsModel.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.UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptionsModel) + result, response, operationErr := vpcService.CreateVolume(createVolumeOptionsModel) 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.UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptionsModel) + result, response, operationErr = vpcService.CreateVolume(createVolumeOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -52097,17 +53056,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptions *UpdateSnapshotConsistencyGroupOptions)`, func() { + Describe(`CreateVolume(createVolumeOptions *CreateVolumeOptions)`, func() { version := "testString" - updateSnapshotConsistencyGroupPath := "/snapshot_consistency_groups/testString" + createVolumePath := "/volumes" 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(updateSnapshotConsistencyGroupPath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(createVolumePath)) + Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -52125,8 +53084,6 @@ 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 @@ -52134,11 +53091,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["ServiceTags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"active": true, "attachment_state": "attached", "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "Message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["UserTags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke UpdateSnapshotConsistencyGroup successfully with retries`, func() { + It(`Invoke CreateVolume successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -52148,30 +53105,48 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the SnapshotConsistencyGroupPatch model - snapshotConsistencyGroupPatchModel := new(vpcv1.SnapshotConsistencyGroupPatch) - snapshotConsistencyGroupPatchModel.DeleteSnapshotsOnDelete = core.BoolPtr(true) - snapshotConsistencyGroupPatchModel.Name = core.StringPtr("my-snapshot-consistency-group") - snapshotConsistencyGroupPatchModelAsPatch, asPatchErr := snapshotConsistencyGroupPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the VolumeProfileIdentityByName model + volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) + volumeProfileIdentityModel.Name = core.StringPtr("5iops-tier") - // Construct an instance of the UpdateSnapshotConsistencyGroupOptions model - updateSnapshotConsistencyGroupOptionsModel := new(vpcv1.UpdateSnapshotConsistencyGroupOptions) - updateSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") - updateSnapshotConsistencyGroupOptionsModel.SnapshotConsistencyGroupPatch = snapshotConsistencyGroupPatchModelAsPatch - updateSnapshotConsistencyGroupOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the VolumePrototypeVolumeByCapacity model + volumePrototypeModel := new(vpcv1.VolumePrototypeVolumeByCapacity) + volumePrototypeModel.Iops = core.Int64Ptr(int64(10000)) + volumePrototypeModel.Name = core.StringPtr("my-volume") + volumePrototypeModel.Profile = volumeProfileIdentityModel + volumePrototypeModel.ResourceGroup = resourceGroupIdentityModel + volumePrototypeModel.UserTags = []string{} + volumePrototypeModel.Zone = zoneIdentityModel + volumePrototypeModel.Capacity = core.Int64Ptr(int64(100)) + volumePrototypeModel.EncryptionKey = encryptionKeyIdentityModel + + // Construct an instance of the CreateVolumeOptions model + createVolumeOptionsModel := new(vpcv1.CreateVolumeOptions) + createVolumeOptionsModel.VolumePrototype = volumePrototypeModel + createVolumeOptionsModel.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.UpdateSnapshotConsistencyGroupWithContext(ctx, updateSnapshotConsistencyGroupOptionsModel) + _, _, operationErr := vpcService.CreateVolumeWithContext(ctx, createVolumeOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptionsModel) + result, response, operationErr := vpcService.CreateVolume(createVolumeOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -52179,7 +53154,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateSnapshotConsistencyGroupWithContext(ctx, updateSnapshotConsistencyGroupOptionsModel) + _, _, operationErr = vpcService.CreateVolumeWithContext(ctx, createVolumeOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -52193,8 +53168,8 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateSnapshotConsistencyGroupPath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(createVolumePath)) + Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -52212,17 +53187,15 @@ 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", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["ServiceTags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"active": true, "attachment_state": "attached", "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "Message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["UserTags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke UpdateSnapshotConsistencyGroup successfully`, func() { + It(`Invoke CreateVolume successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -52232,33 +53205,51 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateSnapshotConsistencyGroup(nil) + result, response, operationErr := vpcService.CreateVolume(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the SnapshotConsistencyGroupPatch model - snapshotConsistencyGroupPatchModel := new(vpcv1.SnapshotConsistencyGroupPatch) - snapshotConsistencyGroupPatchModel.DeleteSnapshotsOnDelete = core.BoolPtr(true) - snapshotConsistencyGroupPatchModel.Name = core.StringPtr("my-snapshot-consistency-group") - snapshotConsistencyGroupPatchModelAsPatch, asPatchErr := snapshotConsistencyGroupPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the VolumeProfileIdentityByName model + volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) + volumeProfileIdentityModel.Name = core.StringPtr("5iops-tier") - // Construct an instance of the UpdateSnapshotConsistencyGroupOptions model - updateSnapshotConsistencyGroupOptionsModel := new(vpcv1.UpdateSnapshotConsistencyGroupOptions) - updateSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") - updateSnapshotConsistencyGroupOptionsModel.SnapshotConsistencyGroupPatch = snapshotConsistencyGroupPatchModelAsPatch - updateSnapshotConsistencyGroupOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the VolumePrototypeVolumeByCapacity model + volumePrototypeModel := new(vpcv1.VolumePrototypeVolumeByCapacity) + volumePrototypeModel.Iops = core.Int64Ptr(int64(10000)) + volumePrototypeModel.Name = core.StringPtr("my-volume") + volumePrototypeModel.Profile = volumeProfileIdentityModel + volumePrototypeModel.ResourceGroup = resourceGroupIdentityModel + volumePrototypeModel.UserTags = []string{} + volumePrototypeModel.Zone = zoneIdentityModel + volumePrototypeModel.Capacity = core.Int64Ptr(int64(100)) + volumePrototypeModel.EncryptionKey = encryptionKeyIdentityModel + + // Construct an instance of the CreateVolumeOptions model + createVolumeOptionsModel := new(vpcv1.CreateVolumeOptions) + createVolumeOptionsModel.VolumePrototype = volumePrototypeModel + createVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptionsModel) + result, response, operationErr = vpcService.CreateVolume(createVolumeOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateSnapshotConsistencyGroup with error: Operation validation and request error`, func() { + It(`Invoke CreateVolume with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -52267,31 +53258,49 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the SnapshotConsistencyGroupPatch model - snapshotConsistencyGroupPatchModel := new(vpcv1.SnapshotConsistencyGroupPatch) - snapshotConsistencyGroupPatchModel.DeleteSnapshotsOnDelete = core.BoolPtr(true) - snapshotConsistencyGroupPatchModel.Name = core.StringPtr("my-snapshot-consistency-group") - snapshotConsistencyGroupPatchModelAsPatch, asPatchErr := snapshotConsistencyGroupPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the VolumeProfileIdentityByName model + volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) + volumeProfileIdentityModel.Name = core.StringPtr("5iops-tier") - // Construct an instance of the UpdateSnapshotConsistencyGroupOptions model - updateSnapshotConsistencyGroupOptionsModel := new(vpcv1.UpdateSnapshotConsistencyGroupOptions) - updateSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") - updateSnapshotConsistencyGroupOptionsModel.SnapshotConsistencyGroupPatch = snapshotConsistencyGroupPatchModelAsPatch - updateSnapshotConsistencyGroupOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the VolumePrototypeVolumeByCapacity model + volumePrototypeModel := new(vpcv1.VolumePrototypeVolumeByCapacity) + volumePrototypeModel.Iops = core.Int64Ptr(int64(10000)) + volumePrototypeModel.Name = core.StringPtr("my-volume") + volumePrototypeModel.Profile = volumeProfileIdentityModel + volumePrototypeModel.ResourceGroup = resourceGroupIdentityModel + volumePrototypeModel.UserTags = []string{} + volumePrototypeModel.Zone = zoneIdentityModel + volumePrototypeModel.Capacity = core.Int64Ptr(int64(100)) + volumePrototypeModel.EncryptionKey = encryptionKeyIdentityModel + + // Construct an instance of the CreateVolumeOptions model + createVolumeOptionsModel := new(vpcv1.CreateVolumeOptions) + createVolumeOptionsModel.VolumePrototype = volumePrototypeModel + createVolumeOptionsModel.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.UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptionsModel) + result, response, operationErr := vpcService.CreateVolume(createVolumeOptionsModel) 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 UpdateSnapshotConsistencyGroupOptions model with no property values - updateSnapshotConsistencyGroupOptionsModelNew := new(vpcv1.UpdateSnapshotConsistencyGroupOptions) + // Construct a second instance of the CreateVolumeOptions model with no property values + createVolumeOptionsModelNew := new(vpcv1.CreateVolumeOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptionsModelNew) + result, response, operationErr = vpcService.CreateVolume(createVolumeOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -52306,10 +53315,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke UpdateSnapshotConsistencyGroup successfully`, func() { + It(`Invoke CreateVolume successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -52318,22 +53327,40 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the SnapshotConsistencyGroupPatch model - snapshotConsistencyGroupPatchModel := new(vpcv1.SnapshotConsistencyGroupPatch) - snapshotConsistencyGroupPatchModel.DeleteSnapshotsOnDelete = core.BoolPtr(true) - snapshotConsistencyGroupPatchModel.Name = core.StringPtr("my-snapshot-consistency-group") - snapshotConsistencyGroupPatchModelAsPatch, asPatchErr := snapshotConsistencyGroupPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the VolumeProfileIdentityByName model + volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) + volumeProfileIdentityModel.Name = core.StringPtr("5iops-tier") - // Construct an instance of the UpdateSnapshotConsistencyGroupOptions model - updateSnapshotConsistencyGroupOptionsModel := new(vpcv1.UpdateSnapshotConsistencyGroupOptions) - updateSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") - updateSnapshotConsistencyGroupOptionsModel.SnapshotConsistencyGroupPatch = snapshotConsistencyGroupPatchModelAsPatch - updateSnapshotConsistencyGroupOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the VolumePrototypeVolumeByCapacity model + volumePrototypeModel := new(vpcv1.VolumePrototypeVolumeByCapacity) + volumePrototypeModel.Iops = core.Int64Ptr(int64(10000)) + volumePrototypeModel.Name = core.StringPtr("my-volume") + volumePrototypeModel.Profile = volumeProfileIdentityModel + volumePrototypeModel.ResourceGroup = resourceGroupIdentityModel + volumePrototypeModel.UserTags = []string{} + volumePrototypeModel.Zone = zoneIdentityModel + volumePrototypeModel.Capacity = core.Int64Ptr(int64(100)) + volumePrototypeModel.EncryptionKey = encryptionKeyIdentityModel + + // Construct an instance of the CreateVolumeOptions model + createVolumeOptionsModel := new(vpcv1.CreateVolumeOptions) + createVolumeOptionsModel.VolumePrototype = volumePrototypeModel + createVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptionsModel) + result, response, operationErr := vpcService.CreateVolume(createVolumeOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -52345,25 +53372,26 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteSnapshots(deleteSnapshotsOptions *DeleteSnapshotsOptions)`, func() { + Describe(`DeleteVolume(deleteVolumeOptions *DeleteVolumeOptions)`, func() { version := "testString" - deleteSnapshotsPath := "/snapshots" + deleteVolumePath := "/volumes/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(deleteSnapshotsPath)) + Expect(req.URL.EscapedPath()).To(Equal(deleteVolumePath)) 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))})) - Expect(req.URL.Query()["source_volume.id"]).To(Equal([]string{"testString"})) res.WriteHeader(204) })) }) - It(`Invoke DeleteSnapshots successfully`, func() { + It(`Invoke DeleteVolume successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -52373,21 +53401,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.DeleteSnapshots(nil) + response, operationErr := vpcService.DeleteVolume(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) - // Construct an instance of the DeleteSnapshotsOptions model - deleteSnapshotsOptionsModel := new(vpcv1.DeleteSnapshotsOptions) - deleteSnapshotsOptionsModel.SourceVolumeID = core.StringPtr("testString") - deleteSnapshotsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteVolumeOptions model + deleteVolumeOptionsModel := new(vpcv1.DeleteVolumeOptions) + deleteVolumeOptionsModel.ID = core.StringPtr("testString") + deleteVolumeOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + deleteVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteSnapshots(deleteSnapshotsOptionsModel) + response, operationErr = vpcService.DeleteVolume(deleteVolumeOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) }) - It(`Invoke DeleteSnapshots with error: Operation validation and request error`, func() { + It(`Invoke DeleteVolume with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -52396,21 +53425,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteSnapshotsOptions model - deleteSnapshotsOptionsModel := new(vpcv1.DeleteSnapshotsOptions) - deleteSnapshotsOptionsModel.SourceVolumeID = core.StringPtr("testString") - deleteSnapshotsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteVolumeOptions model + deleteVolumeOptionsModel := new(vpcv1.DeleteVolumeOptions) + deleteVolumeOptionsModel.ID = core.StringPtr("testString") + deleteVolumeOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + deleteVolumeOptionsModel.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.DeleteSnapshots(deleteSnapshotsOptionsModel) + response, operationErr := vpcService.DeleteVolume(deleteVolumeOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - // Construct a second instance of the DeleteSnapshotsOptions model with no property values - deleteSnapshotsOptionsModelNew := new(vpcv1.DeleteSnapshotsOptions) + // Construct a second instance of the DeleteVolumeOptions model with no property values + deleteVolumeOptionsModelNew := new(vpcv1.DeleteVolumeOptions) // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteSnapshots(deleteSnapshotsOptionsModelNew) + response, operationErr = vpcService.DeleteVolume(deleteVolumeOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) }) @@ -52419,47 +53449,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListSnapshots(listSnapshotsOptions *ListSnapshotsOptions) - Operation response error`, func() { + Describe(`GetVolume(getVolumeOptions *GetVolumeOptions) - Operation response error`, func() { version := "testString" - listSnapshotsPath := "/snapshots" + getVolumePath := "/volumes/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(listSnapshotsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getVolumePath)) 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(10))})) - Expect(req.URL.Query()["tag"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["source_volume.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["source_volume.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5"})) - Expect(req.URL.Query()["source_image.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["source_image.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) - Expect(req.URL.Query()["backup_policy_plan.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["copies[].id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["copies[].name"]).To(Equal([]string{"my-snapshot-copy"})) - Expect(req.URL.Query()["copies[].crn"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["copies[].remote.region.name"]).To(Equal([]string{"us-south"})) - Expect(req.URL.Query()["source_snapshot.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["source_snapshot.remote.region.name"]).To(Equal([]string{"us-south"})) - Expect(req.URL.Query()["source_volume.remote.region.name"]).To(Equal([]string{"us-south"})) - Expect(req.URL.Query()["source_image.remote.region.name"]).To(Equal([]string{"us-south"})) - Expect(req.URL.Query()["clones[].zone.name"]).To(Equal([]string{"us-south-1"})) - Expect(req.URL.Query()["snapshot_consistency_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["snapshot_consistency_group.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListSnapshots with error: Operation response processing error`, func() { + It(`Invoke GetVolume with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -52468,40 +53476,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListSnapshotsOptions model - listSnapshotsOptionsModel := new(vpcv1.ListSnapshotsOptions) - listSnapshotsOptionsModel.Start = core.StringPtr("testString") - listSnapshotsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSnapshotsOptionsModel.Tag = core.StringPtr("testString") - listSnapshotsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listSnapshotsOptionsModel.Name = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceVolumeID = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceVolumeCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - listSnapshotsOptionsModel.SourceImageID = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceImageCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") - listSnapshotsOptionsModel.Sort = core.StringPtr("name") - listSnapshotsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") - listSnapshotsOptionsModel.CopiesID = core.StringPtr("testString") - listSnapshotsOptionsModel.CopiesName = core.StringPtr("my-snapshot-copy") - listSnapshotsOptionsModel.CopiesCRN = core.StringPtr("testString") - listSnapshotsOptionsModel.CopiesRemoteRegionName = core.StringPtr("us-south") - listSnapshotsOptionsModel.SourceSnapshotID = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceSnapshotRemoteRegionName = core.StringPtr("us-south") - listSnapshotsOptionsModel.SourceVolumeRemoteRegionName = core.StringPtr("us-south") - listSnapshotsOptionsModel.SourceImageRemoteRegionName = core.StringPtr("us-south") - listSnapshotsOptionsModel.ClonesZoneName = core.StringPtr("us-south-1") - listSnapshotsOptionsModel.SnapshotConsistencyGroupID = core.StringPtr("testString") - listSnapshotsOptionsModel.SnapshotConsistencyGroupCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263") - listSnapshotsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetVolumeOptions model + getVolumeOptionsModel := new(vpcv1.GetVolumeOptions) + getVolumeOptionsModel.ID = core.StringPtr("testString") + getVolumeOptionsModel.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.ListSnapshots(listSnapshotsOptionsModel) + result, response, operationErr := vpcService.GetVolume(getVolumeOptionsModel) 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.ListSnapshots(listSnapshotsOptionsModel) + result, response, operationErr = vpcService.GetVolume(getVolumeOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -52511,52 +53498,30 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListSnapshots(listSnapshotsOptions *ListSnapshotsOptions)`, func() { + Describe(`GetVolume(getVolumeOptions *GetVolumeOptions)`, func() { version := "testString" - listSnapshotsPath := "/snapshots" + getVolumePath := "/volumes/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(listSnapshotsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getVolumePath)) 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(10))})) - Expect(req.URL.Query()["tag"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["source_volume.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["source_volume.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5"})) - Expect(req.URL.Query()["source_image.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["source_image.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) - Expect(req.URL.Query()["backup_policy_plan.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["copies[].id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["copies[].name"]).To(Equal([]string{"my-snapshot-copy"})) - Expect(req.URL.Query()["copies[].crn"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["copies[].remote.region.name"]).To(Equal([]string{"us-south"})) - Expect(req.URL.Query()["source_snapshot.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["source_snapshot.remote.region.name"]).To(Equal([]string{"us-south"})) - Expect(req.URL.Query()["source_volume.remote.region.name"]).To(Equal([]string{"us-south"})) - Expect(req.URL.Query()["source_image.remote.region.name"]).To(Equal([]string{"us-south"})) - Expect(req.URL.Query()["clones[].zone.name"]).To(Equal([]string{"us-south-1"})) - Expect(req.URL.Query()["snapshot_consistency_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["snapshot_consistency_group.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263"})) // 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/snapshots?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "snapshots": [{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["ServiceTags"], "size": 1, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "user_tags": ["UserTags"]}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"active": true, "attachment_state": "attached", "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "Message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["UserTags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke ListSnapshots successfully with retries`, func() { + It(`Invoke GetVolume successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -52566,42 +53531,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListSnapshotsOptions model - listSnapshotsOptionsModel := new(vpcv1.ListSnapshotsOptions) - listSnapshotsOptionsModel.Start = core.StringPtr("testString") - listSnapshotsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSnapshotsOptionsModel.Tag = core.StringPtr("testString") - listSnapshotsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listSnapshotsOptionsModel.Name = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceVolumeID = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceVolumeCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - listSnapshotsOptionsModel.SourceImageID = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceImageCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") - listSnapshotsOptionsModel.Sort = core.StringPtr("name") - listSnapshotsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") - listSnapshotsOptionsModel.CopiesID = core.StringPtr("testString") - listSnapshotsOptionsModel.CopiesName = core.StringPtr("my-snapshot-copy") - listSnapshotsOptionsModel.CopiesCRN = core.StringPtr("testString") - listSnapshotsOptionsModel.CopiesRemoteRegionName = core.StringPtr("us-south") - listSnapshotsOptionsModel.SourceSnapshotID = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceSnapshotRemoteRegionName = core.StringPtr("us-south") - listSnapshotsOptionsModel.SourceVolumeRemoteRegionName = core.StringPtr("us-south") - listSnapshotsOptionsModel.SourceImageRemoteRegionName = core.StringPtr("us-south") - listSnapshotsOptionsModel.ClonesZoneName = core.StringPtr("us-south-1") - listSnapshotsOptionsModel.SnapshotConsistencyGroupID = core.StringPtr("testString") - listSnapshotsOptionsModel.SnapshotConsistencyGroupCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263") - listSnapshotsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetVolumeOptions model + getVolumeOptionsModel := new(vpcv1.GetVolumeOptions) + getVolumeOptionsModel.ID = core.StringPtr("testString") + getVolumeOptionsModel.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.ListSnapshotsWithContext(ctx, listSnapshotsOptionsModel) + _, _, operationErr := vpcService.GetVolumeWithContext(ctx, getVolumeOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListSnapshots(listSnapshotsOptionsModel) + result, response, operationErr := vpcService.GetVolume(getVolumeOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -52609,7 +53553,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListSnapshotsWithContext(ctx, listSnapshotsOptionsModel) + _, _, operationErr = vpcService.GetVolumeWithContext(ctx, getVolumeOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -52623,40 +53567,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listSnapshotsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getVolumePath)) 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(10))})) - Expect(req.URL.Query()["tag"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["source_volume.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["source_volume.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5"})) - Expect(req.URL.Query()["source_image.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["source_image.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) - Expect(req.URL.Query()["backup_policy_plan.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["copies[].id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["copies[].name"]).To(Equal([]string{"my-snapshot-copy"})) - Expect(req.URL.Query()["copies[].crn"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["copies[].remote.region.name"]).To(Equal([]string{"us-south"})) - Expect(req.URL.Query()["source_snapshot.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["source_snapshot.remote.region.name"]).To(Equal([]string{"us-south"})) - Expect(req.URL.Query()["source_volume.remote.region.name"]).To(Equal([]string{"us-south"})) - Expect(req.URL.Query()["source_image.remote.region.name"]).To(Equal([]string{"us-south"})) - Expect(req.URL.Query()["clones[].zone.name"]).To(Equal([]string{"us-south-1"})) - Expect(req.URL.Query()["snapshot_consistency_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["snapshot_consistency_group.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263"})) // 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/snapshots?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "snapshots": [{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["ServiceTags"], "size": 1, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "user_tags": ["UserTags"]}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"active": true, "attachment_state": "attached", "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "Message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["UserTags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke ListSnapshots successfully`, func() { + It(`Invoke GetVolume successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -52666,45 +53588,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListSnapshots(nil) + result, response, operationErr := vpcService.GetVolume(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListSnapshotsOptions model - listSnapshotsOptionsModel := new(vpcv1.ListSnapshotsOptions) - listSnapshotsOptionsModel.Start = core.StringPtr("testString") - listSnapshotsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSnapshotsOptionsModel.Tag = core.StringPtr("testString") - listSnapshotsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listSnapshotsOptionsModel.Name = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceVolumeID = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceVolumeCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - listSnapshotsOptionsModel.SourceImageID = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceImageCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") - listSnapshotsOptionsModel.Sort = core.StringPtr("name") - listSnapshotsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") - listSnapshotsOptionsModel.CopiesID = core.StringPtr("testString") - listSnapshotsOptionsModel.CopiesName = core.StringPtr("my-snapshot-copy") - listSnapshotsOptionsModel.CopiesCRN = core.StringPtr("testString") - listSnapshotsOptionsModel.CopiesRemoteRegionName = core.StringPtr("us-south") - listSnapshotsOptionsModel.SourceSnapshotID = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceSnapshotRemoteRegionName = core.StringPtr("us-south") - listSnapshotsOptionsModel.SourceVolumeRemoteRegionName = core.StringPtr("us-south") - listSnapshotsOptionsModel.SourceImageRemoteRegionName = core.StringPtr("us-south") - listSnapshotsOptionsModel.ClonesZoneName = core.StringPtr("us-south-1") - listSnapshotsOptionsModel.SnapshotConsistencyGroupID = core.StringPtr("testString") - listSnapshotsOptionsModel.SnapshotConsistencyGroupCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263") - listSnapshotsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetVolumeOptions model + getVolumeOptionsModel := new(vpcv1.GetVolumeOptions) + getVolumeOptionsModel.ID = core.StringPtr("testString") + getVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListSnapshots(listSnapshotsOptionsModel) + result, response, operationErr = vpcService.GetVolume(getVolumeOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListSnapshots with error: Operation request error`, func() { + It(`Invoke GetVolume with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -52713,39 +53614,25 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListSnapshotsOptions model - listSnapshotsOptionsModel := new(vpcv1.ListSnapshotsOptions) - listSnapshotsOptionsModel.Start = core.StringPtr("testString") - listSnapshotsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSnapshotsOptionsModel.Tag = core.StringPtr("testString") - listSnapshotsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listSnapshotsOptionsModel.Name = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceVolumeID = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceVolumeCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - listSnapshotsOptionsModel.SourceImageID = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceImageCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") - listSnapshotsOptionsModel.Sort = core.StringPtr("name") - listSnapshotsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") - listSnapshotsOptionsModel.CopiesID = core.StringPtr("testString") - listSnapshotsOptionsModel.CopiesName = core.StringPtr("my-snapshot-copy") - listSnapshotsOptionsModel.CopiesCRN = core.StringPtr("testString") - listSnapshotsOptionsModel.CopiesRemoteRegionName = core.StringPtr("us-south") - listSnapshotsOptionsModel.SourceSnapshotID = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceSnapshotRemoteRegionName = core.StringPtr("us-south") - listSnapshotsOptionsModel.SourceVolumeRemoteRegionName = core.StringPtr("us-south") - listSnapshotsOptionsModel.SourceImageRemoteRegionName = core.StringPtr("us-south") - listSnapshotsOptionsModel.ClonesZoneName = core.StringPtr("us-south-1") - listSnapshotsOptionsModel.SnapshotConsistencyGroupID = core.StringPtr("testString") - listSnapshotsOptionsModel.SnapshotConsistencyGroupCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263") - listSnapshotsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetVolumeOptions model + getVolumeOptionsModel := new(vpcv1.GetVolumeOptions) + getVolumeOptionsModel.ID = core.StringPtr("testString") + getVolumeOptionsModel.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.ListSnapshots(listSnapshotsOptionsModel) + result, response, operationErr := vpcService.GetVolume(getVolumeOptionsModel) 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 GetVolumeOptions model with no property values + getVolumeOptionsModelNew := new(vpcv1.GetVolumeOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetVolume(getVolumeOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -52760,7 +53647,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListSnapshots successfully`, func() { + It(`Invoke GetVolume successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -52769,34 +53656,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListSnapshotsOptions model - listSnapshotsOptionsModel := new(vpcv1.ListSnapshotsOptions) - listSnapshotsOptionsModel.Start = core.StringPtr("testString") - listSnapshotsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSnapshotsOptionsModel.Tag = core.StringPtr("testString") - listSnapshotsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listSnapshotsOptionsModel.Name = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceVolumeID = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceVolumeCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - listSnapshotsOptionsModel.SourceImageID = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceImageCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") - listSnapshotsOptionsModel.Sort = core.StringPtr("name") - listSnapshotsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") - listSnapshotsOptionsModel.CopiesID = core.StringPtr("testString") - listSnapshotsOptionsModel.CopiesName = core.StringPtr("my-snapshot-copy") - listSnapshotsOptionsModel.CopiesCRN = core.StringPtr("testString") - listSnapshotsOptionsModel.CopiesRemoteRegionName = core.StringPtr("us-south") - listSnapshotsOptionsModel.SourceSnapshotID = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceSnapshotRemoteRegionName = core.StringPtr("us-south") - listSnapshotsOptionsModel.SourceVolumeRemoteRegionName = core.StringPtr("us-south") - listSnapshotsOptionsModel.SourceImageRemoteRegionName = core.StringPtr("us-south") - listSnapshotsOptionsModel.ClonesZoneName = core.StringPtr("us-south-1") - listSnapshotsOptionsModel.SnapshotConsistencyGroupID = core.StringPtr("testString") - listSnapshotsOptionsModel.SnapshotConsistencyGroupCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263") - listSnapshotsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetVolumeOptions model + getVolumeOptionsModel := new(vpcv1.GetVolumeOptions) + getVolumeOptionsModel.ID = core.StringPtr("testString") + getVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListSnapshots(listSnapshotsOptionsModel) + result, response, operationErr := vpcService.GetVolume(getVolumeOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -52807,167 +53673,28 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) - Context(`Test pagination helper method on response`, func() { - It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.SnapshotCollection) - nextObject := new(vpcv1.SnapshotCollectionNext) - 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.SnapshotCollection) - - 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.SnapshotCollection) - nextObject := new(vpcv1.SnapshotCollectionNext) - nextObject.Href = core.StringPtr("ibm.com") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - }) - Context(`Using mock server endpoint - paginated response`, func() { - BeforeEach(func() { - var requestNumber int = 0 - 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(listSnapshotsPath)) - Expect(req.Method).To(Equal("GET")) - - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - requestNumber++ - if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"snapshots":[{"backup_policy_plan":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"bootable":true,"captured_at":"2019-01-01T12:00:00.000Z","clones":[{"available":false,"created_at":"2019-01-01T12:00:00.000Z","zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"copies":[{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}],"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deletable":false,"encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","lifecycle_state":"stable","minimum_capacity":1,"name":"my-snapshot","operating_system":{"architecture":"amd64","dedicated_host_only":false,"display_name":"Ubuntu Server 16.04 LTS amd64","family":"Ubuntu Server","href":"https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64","name":"ubuntu-16-amd64","vendor":"Canonical","version":"16.04 LTS"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"snapshot","service_tags":["ServiceTags"],"size":1,"snapshot_consistency_group":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263","id":"r134-fa329f6b-0e36-433f-a3bb-0df632e79263","name":"my-snapshot-consistency-group","resource_type":"snapshot_consistency_group"},"source_image":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"aa2432b1fa4d4ace891e9b80fc104e34","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"},"source_volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"volume"},"user_tags":["UserTags"]}],"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"snapshots":[{"backup_policy_plan":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"bootable":true,"captured_at":"2019-01-01T12:00:00.000Z","clones":[{"available":false,"created_at":"2019-01-01T12:00:00.000Z","zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"copies":[{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}],"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deletable":false,"encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","lifecycle_state":"stable","minimum_capacity":1,"name":"my-snapshot","operating_system":{"architecture":"amd64","dedicated_host_only":false,"display_name":"Ubuntu Server 16.04 LTS amd64","family":"Ubuntu Server","href":"https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64","name":"ubuntu-16-amd64","vendor":"Canonical","version":"16.04 LTS"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"snapshot","service_tags":["ServiceTags"],"size":1,"snapshot_consistency_group":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263","id":"r134-fa329f6b-0e36-433f-a3bb-0df632e79263","name":"my-snapshot-consistency-group","resource_type":"snapshot_consistency_group"},"source_image":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"aa2432b1fa4d4ace891e9b80fc104e34","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"},"source_volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"volume"},"user_tags":["UserTags"]}],"total_count":2,"limit":1}`) - } else { - res.WriteHeader(400) - } - })) - }) - It(`Use SnapshotsPager.GetNext 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()) - - listSnapshotsOptionsModel := &vpcv1.ListSnapshotsOptions{ - Limit: core.Int64Ptr(int64(10)), - Tag: core.StringPtr("testString"), - ResourceGroupID: core.StringPtr("testString"), - Name: core.StringPtr("testString"), - SourceVolumeID: core.StringPtr("testString"), - SourceVolumeCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5"), - SourceImageID: core.StringPtr("testString"), - SourceImageCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"), - Sort: core.StringPtr("name"), - BackupPolicyPlanID: core.StringPtr("testString"), - CopiesID: core.StringPtr("testString"), - CopiesName: core.StringPtr("my-snapshot-copy"), - CopiesCRN: core.StringPtr("testString"), - CopiesRemoteRegionName: core.StringPtr("us-south"), - SourceSnapshotID: core.StringPtr("testString"), - SourceSnapshotRemoteRegionName: core.StringPtr("us-south"), - SourceVolumeRemoteRegionName: core.StringPtr("us-south"), - SourceImageRemoteRegionName: core.StringPtr("us-south"), - ClonesZoneName: core.StringPtr("us-south-1"), - SnapshotConsistencyGroupID: core.StringPtr("testString"), - SnapshotConsistencyGroupCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263"), - } - - pager, err := vpcService.NewSnapshotsPager(listSnapshotsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.Snapshot - for pager.HasNext() { - nextPage, err := pager.GetNext() - Expect(err).To(BeNil()) - Expect(nextPage).ToNot(BeNil()) - allResults = append(allResults, nextPage...) - } - Expect(len(allResults)).To(Equal(2)) - }) - It(`Use SnapshotsPager.GetAll 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()) - - listSnapshotsOptionsModel := &vpcv1.ListSnapshotsOptions{ - Limit: core.Int64Ptr(int64(10)), - Tag: core.StringPtr("testString"), - ResourceGroupID: core.StringPtr("testString"), - Name: core.StringPtr("testString"), - SourceVolumeID: core.StringPtr("testString"), - SourceVolumeCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5"), - SourceImageID: core.StringPtr("testString"), - SourceImageCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"), - Sort: core.StringPtr("name"), - BackupPolicyPlanID: core.StringPtr("testString"), - CopiesID: core.StringPtr("testString"), - CopiesName: core.StringPtr("my-snapshot-copy"), - CopiesCRN: core.StringPtr("testString"), - CopiesRemoteRegionName: core.StringPtr("us-south"), - SourceSnapshotID: core.StringPtr("testString"), - SourceSnapshotRemoteRegionName: core.StringPtr("us-south"), - SourceVolumeRemoteRegionName: core.StringPtr("us-south"), - SourceImageRemoteRegionName: core.StringPtr("us-south"), - ClonesZoneName: core.StringPtr("us-south-1"), - SnapshotConsistencyGroupID: core.StringPtr("testString"), - SnapshotConsistencyGroupCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263"), - } - - pager, err := vpcService.NewSnapshotsPager(listSnapshotsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - allResults, err := pager.GetAll() - Expect(err).To(BeNil()) - Expect(allResults).ToNot(BeNil()) - Expect(len(allResults)).To(Equal(2)) - }) - }) }) - Describe(`CreateSnapshot(createSnapshotOptions *CreateSnapshotOptions) - Operation response error`, func() { + Describe(`UpdateVolume(updateVolumeOptions *UpdateVolumeOptions) - Operation response error`, func() { version := "testString" - createSnapshotPath := "/snapshots" + updateVolumePath := "/volumes/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(createSnapshotPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(updateVolumePath)) + 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(201) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateSnapshot with error: Operation response processing error`, func() { + It(`Invoke UpdateVolume with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -52976,43 +53703,35 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the SnapshotClonePrototype model - snapshotClonePrototypeModel := new(vpcv1.SnapshotClonePrototype) - snapshotClonePrototypeModel.Zone = zoneIdentityModel - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the VolumeIdentityByID model - volumeIdentityModel := new(vpcv1.VolumeIdentityByID) - volumeIdentityModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + // Construct an instance of the VolumeProfileIdentityByName model + volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) + volumeProfileIdentityModel.Name = core.StringPtr("general-purpose") - // Construct an instance of the SnapshotPrototypeSnapshotBySourceVolume model - snapshotPrototypeModel := new(vpcv1.SnapshotPrototypeSnapshotBySourceVolume) - snapshotPrototypeModel.Clones = []vpcv1.SnapshotClonePrototype{*snapshotClonePrototypeModel} - snapshotPrototypeModel.Name = core.StringPtr("my-snapshot") - snapshotPrototypeModel.ResourceGroup = resourceGroupIdentityModel - snapshotPrototypeModel.UserTags = []string{} - snapshotPrototypeModel.SourceVolume = volumeIdentityModel + // Construct an instance of the VolumePatch model + volumePatchModel := new(vpcv1.VolumePatch) + volumePatchModel.Capacity = core.Int64Ptr(int64(100)) + volumePatchModel.Iops = core.Int64Ptr(int64(10000)) + volumePatchModel.Name = core.StringPtr("my-volume") + volumePatchModel.Profile = volumeProfileIdentityModel + volumePatchModel.UserTags = []string{"testString"} + volumePatchModelAsPatch, asPatchErr := volumePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) - // Construct an instance of the CreateSnapshotOptions model - createSnapshotOptionsModel := new(vpcv1.CreateSnapshotOptions) - createSnapshotOptionsModel.SnapshotPrototype = snapshotPrototypeModel - createSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateVolumeOptions model + updateVolumeOptionsModel := new(vpcv1.UpdateVolumeOptions) + updateVolumeOptionsModel.ID = core.StringPtr("testString") + updateVolumeOptionsModel.VolumePatch = volumePatchModelAsPatch + updateVolumeOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateVolumeOptionsModel.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.CreateSnapshot(createSnapshotOptionsModel) + result, response, operationErr := vpcService.UpdateVolume(updateVolumeOptionsModel) 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.CreateSnapshot(createSnapshotOptionsModel) + result, response, operationErr = vpcService.UpdateVolume(updateVolumeOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -53022,17 +53741,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateSnapshot(createSnapshotOptions *CreateSnapshotOptions)`, func() { + Describe(`UpdateVolume(updateVolumeOptions *UpdateVolumeOptions)`, func() { version := "testString" - createSnapshotPath := "/snapshots" + updateVolumePath := "/volumes/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(createSnapshotPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(updateVolumePath)) + Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -53050,6 +53769,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 @@ -53057,11 +53778,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["ServiceTags"], "size": 1, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "user_tags": ["UserTags"]}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"active": true, "attachment_state": "attached", "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "Message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["UserTags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke CreateSnapshot successfully with retries`, func() { + It(`Invoke UpdateVolume successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -53071,45 +53792,37 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the SnapshotClonePrototype model - snapshotClonePrototypeModel := new(vpcv1.SnapshotClonePrototype) - snapshotClonePrototypeModel.Zone = zoneIdentityModel - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the VolumeIdentityByID model - volumeIdentityModel := new(vpcv1.VolumeIdentityByID) - volumeIdentityModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + // Construct an instance of the VolumeProfileIdentityByName model + volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) + volumeProfileIdentityModel.Name = core.StringPtr("general-purpose") - // Construct an instance of the SnapshotPrototypeSnapshotBySourceVolume model - snapshotPrototypeModel := new(vpcv1.SnapshotPrototypeSnapshotBySourceVolume) - snapshotPrototypeModel.Clones = []vpcv1.SnapshotClonePrototype{*snapshotClonePrototypeModel} - snapshotPrototypeModel.Name = core.StringPtr("my-snapshot") - snapshotPrototypeModel.ResourceGroup = resourceGroupIdentityModel - snapshotPrototypeModel.UserTags = []string{} - snapshotPrototypeModel.SourceVolume = volumeIdentityModel + // Construct an instance of the VolumePatch model + volumePatchModel := new(vpcv1.VolumePatch) + volumePatchModel.Capacity = core.Int64Ptr(int64(100)) + volumePatchModel.Iops = core.Int64Ptr(int64(10000)) + volumePatchModel.Name = core.StringPtr("my-volume") + volumePatchModel.Profile = volumeProfileIdentityModel + volumePatchModel.UserTags = []string{"testString"} + volumePatchModelAsPatch, asPatchErr := volumePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) - // Construct an instance of the CreateSnapshotOptions model - createSnapshotOptionsModel := new(vpcv1.CreateSnapshotOptions) - createSnapshotOptionsModel.SnapshotPrototype = snapshotPrototypeModel - createSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateVolumeOptions model + updateVolumeOptionsModel := new(vpcv1.UpdateVolumeOptions) + updateVolumeOptionsModel.ID = core.StringPtr("testString") + updateVolumeOptionsModel.VolumePatch = volumePatchModelAsPatch + updateVolumeOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateVolumeOptionsModel.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.CreateSnapshotWithContext(ctx, createSnapshotOptionsModel) + _, _, operationErr := vpcService.UpdateVolumeWithContext(ctx, updateVolumeOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateSnapshot(createSnapshotOptionsModel) + result, response, operationErr := vpcService.UpdateVolume(updateVolumeOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -53117,7 +53830,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreateSnapshotWithContext(ctx, createSnapshotOptionsModel) + _, _, operationErr = vpcService.UpdateVolumeWithContext(ctx, updateVolumeOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -53131,8 +53844,8 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createSnapshotPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(updateVolumePath)) + Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -53150,15 +53863,17 @@ 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(201) - fmt.Fprintf(res, "%s", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["ServiceTags"], "size": 1, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "user_tags": ["UserTags"]}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"active": true, "attachment_state": "attached", "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "health_reasons": [{"code": "initializing_from_snapshot", "message": "Performance will be degraded while this volume is being initialized from its snapshot", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-troubleshooting&interface=ui#snapshot_ts_degraded_perf"}], "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "volume", "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "status": "available", "status_reasons": [{"code": "encryption_key_deleted", "message": "Message", "more_info": "https://cloud.ibm.com/docs/key-protect?topic=key-protect-restore-keys"}], "user_tags": ["UserTags"], "volume_attachments": [{"delete_volume_on_instance_delete": true, "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "device": {"id": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "name": "my-volume-attachment", "type": "boot"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke CreateSnapshot successfully`, func() { + It(`Invoke UpdateVolume successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -53168,48 +53883,40 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreateSnapshot(nil) + result, response, operationErr := vpcService.UpdateVolume(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the SnapshotClonePrototype model - snapshotClonePrototypeModel := new(vpcv1.SnapshotClonePrototype) - snapshotClonePrototypeModel.Zone = zoneIdentityModel - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the VolumeIdentityByID model - volumeIdentityModel := new(vpcv1.VolumeIdentityByID) - volumeIdentityModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + // Construct an instance of the VolumeProfileIdentityByName model + volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) + volumeProfileIdentityModel.Name = core.StringPtr("general-purpose") - // Construct an instance of the SnapshotPrototypeSnapshotBySourceVolume model - snapshotPrototypeModel := new(vpcv1.SnapshotPrototypeSnapshotBySourceVolume) - snapshotPrototypeModel.Clones = []vpcv1.SnapshotClonePrototype{*snapshotClonePrototypeModel} - snapshotPrototypeModel.Name = core.StringPtr("my-snapshot") - snapshotPrototypeModel.ResourceGroup = resourceGroupIdentityModel - snapshotPrototypeModel.UserTags = []string{} - snapshotPrototypeModel.SourceVolume = volumeIdentityModel + // Construct an instance of the VolumePatch model + volumePatchModel := new(vpcv1.VolumePatch) + volumePatchModel.Capacity = core.Int64Ptr(int64(100)) + volumePatchModel.Iops = core.Int64Ptr(int64(10000)) + volumePatchModel.Name = core.StringPtr("my-volume") + volumePatchModel.Profile = volumeProfileIdentityModel + volumePatchModel.UserTags = []string{"testString"} + volumePatchModelAsPatch, asPatchErr := volumePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) - // Construct an instance of the CreateSnapshotOptions model - createSnapshotOptionsModel := new(vpcv1.CreateSnapshotOptions) - createSnapshotOptionsModel.SnapshotPrototype = snapshotPrototypeModel - createSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateVolumeOptions model + updateVolumeOptionsModel := new(vpcv1.UpdateVolumeOptions) + updateVolumeOptionsModel.ID = core.StringPtr("testString") + updateVolumeOptionsModel.VolumePatch = volumePatchModelAsPatch + updateVolumeOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateSnapshot(createSnapshotOptionsModel) + result, response, operationErr = vpcService.UpdateVolume(updateVolumeOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateSnapshot with error: Operation validation and request error`, func() { + It(`Invoke UpdateVolume with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -53218,46 +53925,38 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the SnapshotClonePrototype model - snapshotClonePrototypeModel := new(vpcv1.SnapshotClonePrototype) - snapshotClonePrototypeModel.Zone = zoneIdentityModel - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the VolumeIdentityByID model - volumeIdentityModel := new(vpcv1.VolumeIdentityByID) - volumeIdentityModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + // Construct an instance of the VolumeProfileIdentityByName model + volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) + volumeProfileIdentityModel.Name = core.StringPtr("general-purpose") - // Construct an instance of the SnapshotPrototypeSnapshotBySourceVolume model - snapshotPrototypeModel := new(vpcv1.SnapshotPrototypeSnapshotBySourceVolume) - snapshotPrototypeModel.Clones = []vpcv1.SnapshotClonePrototype{*snapshotClonePrototypeModel} - snapshotPrototypeModel.Name = core.StringPtr("my-snapshot") - snapshotPrototypeModel.ResourceGroup = resourceGroupIdentityModel - snapshotPrototypeModel.UserTags = []string{} - snapshotPrototypeModel.SourceVolume = volumeIdentityModel + // Construct an instance of the VolumePatch model + volumePatchModel := new(vpcv1.VolumePatch) + volumePatchModel.Capacity = core.Int64Ptr(int64(100)) + volumePatchModel.Iops = core.Int64Ptr(int64(10000)) + volumePatchModel.Name = core.StringPtr("my-volume") + volumePatchModel.Profile = volumeProfileIdentityModel + volumePatchModel.UserTags = []string{"testString"} + volumePatchModelAsPatch, asPatchErr := volumePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) - // Construct an instance of the CreateSnapshotOptions model - createSnapshotOptionsModel := new(vpcv1.CreateSnapshotOptions) - createSnapshotOptionsModel.SnapshotPrototype = snapshotPrototypeModel - createSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateVolumeOptions model + updateVolumeOptionsModel := new(vpcv1.UpdateVolumeOptions) + updateVolumeOptionsModel.ID = core.StringPtr("testString") + updateVolumeOptionsModel.VolumePatch = volumePatchModelAsPatch + updateVolumeOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateVolumeOptionsModel.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.CreateSnapshot(createSnapshotOptionsModel) + result, response, operationErr := vpcService.UpdateVolume(updateVolumeOptionsModel) 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 CreateSnapshotOptions model with no property values - createSnapshotOptionsModelNew := new(vpcv1.CreateSnapshotOptions) + // Construct a second instance of the UpdateVolumeOptions model with no property values + updateVolumeOptionsModelNew := new(vpcv1.UpdateVolumeOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateSnapshot(createSnapshotOptionsModelNew) + result, response, operationErr = vpcService.UpdateVolume(updateVolumeOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -53272,10 +53971,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke CreateSnapshot successfully`, func() { + It(`Invoke UpdateVolume successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -53284,37 +53983,29 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the SnapshotClonePrototype model - snapshotClonePrototypeModel := new(vpcv1.SnapshotClonePrototype) - snapshotClonePrototypeModel.Zone = zoneIdentityModel - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the VolumeIdentityByID model - volumeIdentityModel := new(vpcv1.VolumeIdentityByID) - volumeIdentityModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + // Construct an instance of the VolumeProfileIdentityByName model + volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) + volumeProfileIdentityModel.Name = core.StringPtr("general-purpose") - // Construct an instance of the SnapshotPrototypeSnapshotBySourceVolume model - snapshotPrototypeModel := new(vpcv1.SnapshotPrototypeSnapshotBySourceVolume) - snapshotPrototypeModel.Clones = []vpcv1.SnapshotClonePrototype{*snapshotClonePrototypeModel} - snapshotPrototypeModel.Name = core.StringPtr("my-snapshot") - snapshotPrototypeModel.ResourceGroup = resourceGroupIdentityModel - snapshotPrototypeModel.UserTags = []string{} - snapshotPrototypeModel.SourceVolume = volumeIdentityModel + // Construct an instance of the VolumePatch model + volumePatchModel := new(vpcv1.VolumePatch) + volumePatchModel.Capacity = core.Int64Ptr(int64(100)) + volumePatchModel.Iops = core.Int64Ptr(int64(10000)) + volumePatchModel.Name = core.StringPtr("my-volume") + volumePatchModel.Profile = volumeProfileIdentityModel + volumePatchModel.UserTags = []string{"testString"} + volumePatchModelAsPatch, asPatchErr := volumePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) - // Construct an instance of the CreateSnapshotOptions model - createSnapshotOptionsModel := new(vpcv1.CreateSnapshotOptions) - createSnapshotOptionsModel.SnapshotPrototype = snapshotPrototypeModel - createSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateVolumeOptions model + updateVolumeOptionsModel := new(vpcv1.UpdateVolumeOptions) + updateVolumeOptionsModel.ID = core.StringPtr("testString") + updateVolumeOptionsModel.VolumePatch = volumePatchModelAsPatch + updateVolumeOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateVolumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.CreateSnapshot(createSnapshotOptionsModel) + result, response, operationErr := vpcService.UpdateVolume(updateVolumeOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -53326,102 +54017,31 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteSnapshot(deleteSnapshotOptions *DeleteSnapshotOptions)`, func() { - version := "testString" - deleteSnapshotPath := "/snapshots/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(deleteSnapshotPath)) - 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) - })) - }) - It(`Invoke DeleteSnapshot 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.DeleteSnapshot(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteSnapshotOptions model - deleteSnapshotOptionsModel := new(vpcv1.DeleteSnapshotOptions) - deleteSnapshotOptionsModel.ID = core.StringPtr("testString") - deleteSnapshotOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - deleteSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteSnapshot(deleteSnapshotOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteSnapshot 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 DeleteSnapshotOptions model - deleteSnapshotOptionsModel := new(vpcv1.DeleteSnapshotOptions) - deleteSnapshotOptionsModel.ID = core.StringPtr("testString") - deleteSnapshotOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - deleteSnapshotOptionsModel.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.DeleteSnapshot(deleteSnapshotOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteSnapshotOptions model with no property values - deleteSnapshotOptionsModelNew := new(vpcv1.DeleteSnapshotOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteSnapshot(deleteSnapshotOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetSnapshot(getSnapshotOptions *GetSnapshotOptions) - Operation response error`, func() { + Describe(`ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptions *ListSnapshotConsistencyGroupsOptions) - Operation response error`, func() { version := "testString" - getSnapshotPath := "/snapshots/testString" + listSnapshotConsistencyGroupsPath := "/snapshot_consistency_groups" 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(getSnapshotPath)) + Expect(req.URL.EscapedPath()).To(Equal(listSnapshotConsistencyGroupsPath)) 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(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) + Expect(req.URL.Query()["backup_policy_plan.id"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetSnapshot with error: Operation response processing error`, func() { + It(`Invoke ListSnapshotConsistencyGroups with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -53430,19 +54050,24 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetSnapshotOptions model - getSnapshotOptionsModel := new(vpcv1.GetSnapshotOptions) - getSnapshotOptionsModel.ID = core.StringPtr("testString") - getSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSnapshotConsistencyGroupsOptions model + listSnapshotConsistencyGroupsOptionsModel := new(vpcv1.ListSnapshotConsistencyGroupsOptions) + listSnapshotConsistencyGroupsOptionsModel.Start = core.StringPtr("testString") + listSnapshotConsistencyGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listSnapshotConsistencyGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSnapshotConsistencyGroupsOptionsModel.Name = core.StringPtr("testString") + listSnapshotConsistencyGroupsOptionsModel.Sort = core.StringPtr("name") + listSnapshotConsistencyGroupsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") + listSnapshotConsistencyGroupsOptionsModel.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.GetSnapshot(getSnapshotOptionsModel) + result, response, operationErr := vpcService.ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptionsModel) 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.GetSnapshot(getSnapshotOptionsModel) + result, response, operationErr = vpcService.ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -53452,30 +54077,36 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetSnapshot(getSnapshotOptions *GetSnapshotOptions)`, func() { + Describe(`ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptions *ListSnapshotConsistencyGroupsOptions)`, func() { version := "testString" - getSnapshotPath := "/snapshots/testString" + listSnapshotConsistencyGroupsPath := "/snapshot_consistency_groups" 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(getSnapshotPath)) + Expect(req.URL.EscapedPath()).To(Equal(listSnapshotConsistencyGroupsPath)) 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(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) + Expect(req.URL.Query()["backup_policy_plan.id"]).To(Equal([]string{"testString"})) // 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", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["ServiceTags"], "size": 1, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "user_tags": ["UserTags"]}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "snapshot_consistency_groups": [{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["ServiceTags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}], "total_count": 132}`) })) }) - It(`Invoke GetSnapshot successfully with retries`, func() { + It(`Invoke ListSnapshotConsistencyGroups successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -53485,21 +54116,26 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetSnapshotOptions model - getSnapshotOptionsModel := new(vpcv1.GetSnapshotOptions) - getSnapshotOptionsModel.ID = core.StringPtr("testString") - getSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSnapshotConsistencyGroupsOptions model + listSnapshotConsistencyGroupsOptionsModel := new(vpcv1.ListSnapshotConsistencyGroupsOptions) + listSnapshotConsistencyGroupsOptionsModel.Start = core.StringPtr("testString") + listSnapshotConsistencyGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listSnapshotConsistencyGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSnapshotConsistencyGroupsOptionsModel.Name = core.StringPtr("testString") + listSnapshotConsistencyGroupsOptionsModel.Sort = core.StringPtr("name") + listSnapshotConsistencyGroupsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") + listSnapshotConsistencyGroupsOptionsModel.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.GetSnapshotWithContext(ctx, getSnapshotOptionsModel) + _, _, operationErr := vpcService.ListSnapshotConsistencyGroupsWithContext(ctx, listSnapshotConsistencyGroupsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetSnapshot(getSnapshotOptionsModel) + result, response, operationErr := vpcService.ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -53507,7 +54143,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetSnapshotWithContext(ctx, getSnapshotOptionsModel) + _, _, operationErr = vpcService.ListSnapshotConsistencyGroupsWithContext(ctx, listSnapshotConsistencyGroupsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -53521,18 +54157,24 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSnapshotPath)) + Expect(req.URL.EscapedPath()).To(Equal(listSnapshotConsistencyGroupsPath)) 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(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) + Expect(req.URL.Query()["backup_policy_plan.id"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["ServiceTags"], "size": 1, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "user_tags": ["UserTags"]}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "snapshot_consistency_groups": [{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["ServiceTags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}], "total_count": 132}`) })) }) - It(`Invoke GetSnapshot successfully`, func() { + It(`Invoke ListSnapshotConsistencyGroups successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -53542,24 +54184,29 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetSnapshot(nil) + result, response, operationErr := vpcService.ListSnapshotConsistencyGroups(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetSnapshotOptions model - getSnapshotOptionsModel := new(vpcv1.GetSnapshotOptions) - getSnapshotOptionsModel.ID = core.StringPtr("testString") - getSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSnapshotConsistencyGroupsOptions model + listSnapshotConsistencyGroupsOptionsModel := new(vpcv1.ListSnapshotConsistencyGroupsOptions) + listSnapshotConsistencyGroupsOptionsModel.Start = core.StringPtr("testString") + listSnapshotConsistencyGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listSnapshotConsistencyGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSnapshotConsistencyGroupsOptionsModel.Name = core.StringPtr("testString") + listSnapshotConsistencyGroupsOptionsModel.Sort = core.StringPtr("name") + listSnapshotConsistencyGroupsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") + listSnapshotConsistencyGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetSnapshot(getSnapshotOptionsModel) + result, response, operationErr = vpcService.ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetSnapshot with error: Operation validation and request error`, func() { + It(`Invoke ListSnapshotConsistencyGroups with error: Operation request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -53568,25 +54215,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetSnapshotOptions model - getSnapshotOptionsModel := new(vpcv1.GetSnapshotOptions) - getSnapshotOptionsModel.ID = core.StringPtr("testString") - getSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSnapshotConsistencyGroupsOptions model + listSnapshotConsistencyGroupsOptionsModel := new(vpcv1.ListSnapshotConsistencyGroupsOptions) + listSnapshotConsistencyGroupsOptionsModel.Start = core.StringPtr("testString") + listSnapshotConsistencyGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listSnapshotConsistencyGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSnapshotConsistencyGroupsOptionsModel.Name = core.StringPtr("testString") + listSnapshotConsistencyGroupsOptionsModel.Sort = core.StringPtr("name") + listSnapshotConsistencyGroupsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") + listSnapshotConsistencyGroupsOptionsModel.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.GetSnapshot(getSnapshotOptionsModel) + result, response, operationErr := vpcService.ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptionsModel) 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 GetSnapshotOptions model with no property values - getSnapshotOptionsModelNew := new(vpcv1.GetSnapshotOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetSnapshot(getSnapshotOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -53601,7 +54246,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetSnapshot successfully`, func() { + It(`Invoke ListSnapshotConsistencyGroups successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -53610,13 +54255,18 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetSnapshotOptions model - getSnapshotOptionsModel := new(vpcv1.GetSnapshotOptions) - getSnapshotOptionsModel.ID = core.StringPtr("testString") - getSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSnapshotConsistencyGroupsOptions model + listSnapshotConsistencyGroupsOptionsModel := new(vpcv1.ListSnapshotConsistencyGroupsOptions) + listSnapshotConsistencyGroupsOptionsModel.Start = core.StringPtr("testString") + listSnapshotConsistencyGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listSnapshotConsistencyGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSnapshotConsistencyGroupsOptionsModel.Name = core.StringPtr("testString") + listSnapshotConsistencyGroupsOptionsModel.Sort = core.StringPtr("name") + listSnapshotConsistencyGroupsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") + listSnapshotConsistencyGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetSnapshot(getSnapshotOptionsModel) + result, response, operationErr := vpcService.ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -53627,28 +54277,135 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(vpcv1.SnapshotConsistencyGroupCollection) + nextObject := new(vpcv1.SnapshotConsistencyGroupCollectionNext) + 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.SnapshotConsistencyGroupCollection) + + 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.SnapshotConsistencyGroupCollection) + nextObject := new(vpcv1.SnapshotConsistencyGroupCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { + BeforeEach(func() { + var requestNumber int = 0 + 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(listSnapshotConsistencyGroupsPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"snapshot_consistency_groups":[{"backup_policy_plan":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263","delete_snapshots_on_delete":false,"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263","id":"r134-fa329f6b-0e36-433f-a3bb-0df632e79263","lifecycle_state":"stable","name":"my-snapshot-consistency-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"snapshot_consistency_group","service_tags":["ServiceTags"],"snapshots":[{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}]}],"total_count":2,"limit":1}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"snapshot_consistency_groups":[{"backup_policy_plan":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263","delete_snapshots_on_delete":false,"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263","id":"r134-fa329f6b-0e36-433f-a3bb-0df632e79263","lifecycle_state":"stable","name":"my-snapshot-consistency-group","resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"snapshot_consistency_group","service_tags":["ServiceTags"],"snapshots":[{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}]}],"total_count":2,"limit":1}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use SnapshotConsistencyGroupsPager.GetNext 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()) + + listSnapshotConsistencyGroupsOptionsModel := &vpcv1.ListSnapshotConsistencyGroupsOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + Name: core.StringPtr("testString"), + Sort: core.StringPtr("name"), + BackupPolicyPlanID: core.StringPtr("testString"), + } + + pager, err := vpcService.NewSnapshotConsistencyGroupsPager(listSnapshotConsistencyGroupsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.SnapshotConsistencyGroup + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) + }) + It(`Use SnapshotConsistencyGroupsPager.GetAll 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()) + + listSnapshotConsistencyGroupsOptionsModel := &vpcv1.ListSnapshotConsistencyGroupsOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + Name: core.StringPtr("testString"), + Sort: core.StringPtr("name"), + BackupPolicyPlanID: core.StringPtr("testString"), + } + + pager, err := vpcService.NewSnapshotConsistencyGroupsPager(listSnapshotConsistencyGroupsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) + }) + }) }) - Describe(`UpdateSnapshot(updateSnapshotOptions *UpdateSnapshotOptions) - Operation response error`, func() { + Describe(`CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptions *CreateSnapshotConsistencyGroupOptions) - Operation response error`, func() { version := "testString" - updateSnapshotPath := "/snapshots/testString" + createSnapshotConsistencyGroupPath := "/snapshot_consistency_groups" 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(updateSnapshotPath)) - 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.EscapedPath()).To(Equal(createSnapshotConsistencyGroupPath)) + 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(200) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateSnapshot with error: Operation response processing error`, func() { + It(`Invoke CreateSnapshotConsistencyGroup with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -53657,28 +54414,40 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the SnapshotPatch model - snapshotPatchModel := new(vpcv1.SnapshotPatch) - snapshotPatchModel.Name = core.StringPtr("my-snapshot") - snapshotPatchModel.UserTags = []string{"testString"} - snapshotPatchModelAsPatch, asPatchErr := snapshotPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - // Construct an instance of the UpdateSnapshotOptions model - updateSnapshotOptionsModel := new(vpcv1.UpdateSnapshotOptions) - updateSnapshotOptionsModel.ID = core.StringPtr("testString") - updateSnapshotOptionsModel.SnapshotPatch = snapshotPatchModelAsPatch - updateSnapshotOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VolumeIdentityByID model + volumeIdentityModel := new(vpcv1.VolumeIdentityByID) + volumeIdentityModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + + // Construct an instance of the SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem model + snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel := new(vpcv1.SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem) + snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel.Name = core.StringPtr("my-snapshot") + snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel.SourceVolume = volumeIdentityModel + snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel.UserTags = []string{"testString"} + + // Construct an instance of the SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots model + snapshotConsistencyGroupPrototypeModel := new(vpcv1.SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots) + snapshotConsistencyGroupPrototypeModel.DeleteSnapshotsOnDelete = core.BoolPtr(true) + snapshotConsistencyGroupPrototypeModel.Name = core.StringPtr("my-snapshot-consistency-group") + snapshotConsistencyGroupPrototypeModel.ResourceGroup = resourceGroupIdentityModel + snapshotConsistencyGroupPrototypeModel.Snapshots = []vpcv1.SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem{*snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel} + + // Construct an instance of the CreateSnapshotConsistencyGroupOptions model + createSnapshotConsistencyGroupOptionsModel := new(vpcv1.CreateSnapshotConsistencyGroupOptions) + createSnapshotConsistencyGroupOptionsModel.SnapshotConsistencyGroupPrototype = snapshotConsistencyGroupPrototypeModel + createSnapshotConsistencyGroupOptionsModel.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.UpdateSnapshot(updateSnapshotOptionsModel) + result, response, operationErr := vpcService.CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptionsModel) 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.UpdateSnapshot(updateSnapshotOptionsModel) + result, response, operationErr = vpcService.CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -53688,17 +54457,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateSnapshot(updateSnapshotOptions *UpdateSnapshotOptions)`, func() { + Describe(`CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptions *CreateSnapshotConsistencyGroupOptions)`, func() { version := "testString" - updateSnapshotPath := "/snapshots/testString" + createSnapshotConsistencyGroupPath := "/snapshot_consistency_groups" 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(updateSnapshotPath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(createSnapshotConsistencyGroupPath)) + Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -53716,8 +54485,6 @@ 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 @@ -53725,11 +54492,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["ServiceTags"], "size": 1, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "user_tags": ["UserTags"]}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["ServiceTags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}`) })) }) - It(`Invoke UpdateSnapshot successfully with retries`, func() { + It(`Invoke CreateSnapshotConsistencyGroup successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -53739,30 +54506,42 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the SnapshotPatch model - snapshotPatchModel := new(vpcv1.SnapshotPatch) - snapshotPatchModel.Name = core.StringPtr("my-snapshot") - snapshotPatchModel.UserTags = []string{"testString"} - snapshotPatchModelAsPatch, asPatchErr := snapshotPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - // Construct an instance of the UpdateSnapshotOptions model - updateSnapshotOptionsModel := new(vpcv1.UpdateSnapshotOptions) - updateSnapshotOptionsModel.ID = core.StringPtr("testString") - updateSnapshotOptionsModel.SnapshotPatch = snapshotPatchModelAsPatch - updateSnapshotOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VolumeIdentityByID model + volumeIdentityModel := new(vpcv1.VolumeIdentityByID) + volumeIdentityModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + + // Construct an instance of the SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem model + snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel := new(vpcv1.SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem) + snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel.Name = core.StringPtr("my-snapshot") + snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel.SourceVolume = volumeIdentityModel + snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel.UserTags = []string{"testString"} + + // Construct an instance of the SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots model + snapshotConsistencyGroupPrototypeModel := new(vpcv1.SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots) + snapshotConsistencyGroupPrototypeModel.DeleteSnapshotsOnDelete = core.BoolPtr(true) + snapshotConsistencyGroupPrototypeModel.Name = core.StringPtr("my-snapshot-consistency-group") + snapshotConsistencyGroupPrototypeModel.ResourceGroup = resourceGroupIdentityModel + snapshotConsistencyGroupPrototypeModel.Snapshots = []vpcv1.SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem{*snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel} + + // Construct an instance of the CreateSnapshotConsistencyGroupOptions model + createSnapshotConsistencyGroupOptionsModel := new(vpcv1.CreateSnapshotConsistencyGroupOptions) + createSnapshotConsistencyGroupOptionsModel.SnapshotConsistencyGroupPrototype = snapshotConsistencyGroupPrototypeModel + createSnapshotConsistencyGroupOptionsModel.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.UpdateSnapshotWithContext(ctx, updateSnapshotOptionsModel) + _, _, operationErr := vpcService.CreateSnapshotConsistencyGroupWithContext(ctx, createSnapshotConsistencyGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateSnapshot(updateSnapshotOptionsModel) + result, response, operationErr := vpcService.CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -53770,7 +54549,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateSnapshotWithContext(ctx, updateSnapshotOptionsModel) + _, _, operationErr = vpcService.CreateSnapshotConsistencyGroupWithContext(ctx, createSnapshotConsistencyGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -53784,8 +54563,8 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateSnapshotPath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(createSnapshotConsistencyGroupPath)) + Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -53803,17 +54582,15 @@ 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", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["ServiceTags"], "size": 1, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "user_tags": ["UserTags"]}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["ServiceTags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}`) })) }) - It(`Invoke UpdateSnapshot successfully`, func() { + It(`Invoke CreateSnapshotConsistencyGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -53823,33 +54600,45 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateSnapshot(nil) + result, response, operationErr := vpcService.CreateSnapshotConsistencyGroup(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the SnapshotPatch model - snapshotPatchModel := new(vpcv1.SnapshotPatch) - snapshotPatchModel.Name = core.StringPtr("my-snapshot") - snapshotPatchModel.UserTags = []string{"testString"} - snapshotPatchModelAsPatch, asPatchErr := snapshotPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - // Construct an instance of the UpdateSnapshotOptions model - updateSnapshotOptionsModel := new(vpcv1.UpdateSnapshotOptions) - updateSnapshotOptionsModel.ID = core.StringPtr("testString") - updateSnapshotOptionsModel.SnapshotPatch = snapshotPatchModelAsPatch - updateSnapshotOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VolumeIdentityByID model + volumeIdentityModel := new(vpcv1.VolumeIdentityByID) + volumeIdentityModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + + // Construct an instance of the SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem model + snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel := new(vpcv1.SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem) + snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel.Name = core.StringPtr("my-snapshot") + snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel.SourceVolume = volumeIdentityModel + snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel.UserTags = []string{"testString"} + + // Construct an instance of the SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots model + snapshotConsistencyGroupPrototypeModel := new(vpcv1.SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots) + snapshotConsistencyGroupPrototypeModel.DeleteSnapshotsOnDelete = core.BoolPtr(true) + snapshotConsistencyGroupPrototypeModel.Name = core.StringPtr("my-snapshot-consistency-group") + snapshotConsistencyGroupPrototypeModel.ResourceGroup = resourceGroupIdentityModel + snapshotConsistencyGroupPrototypeModel.Snapshots = []vpcv1.SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem{*snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel} + + // Construct an instance of the CreateSnapshotConsistencyGroupOptions model + createSnapshotConsistencyGroupOptionsModel := new(vpcv1.CreateSnapshotConsistencyGroupOptions) + createSnapshotConsistencyGroupOptionsModel.SnapshotConsistencyGroupPrototype = snapshotConsistencyGroupPrototypeModel + createSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateSnapshot(updateSnapshotOptionsModel) + result, response, operationErr = vpcService.CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateSnapshot with error: Operation validation and request error`, func() { + It(`Invoke CreateSnapshotConsistencyGroup with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -53858,31 +54647,43 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the SnapshotPatch model - snapshotPatchModel := new(vpcv1.SnapshotPatch) - snapshotPatchModel.Name = core.StringPtr("my-snapshot") - snapshotPatchModel.UserTags = []string{"testString"} - snapshotPatchModelAsPatch, asPatchErr := snapshotPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - // Construct an instance of the UpdateSnapshotOptions model - updateSnapshotOptionsModel := new(vpcv1.UpdateSnapshotOptions) - updateSnapshotOptionsModel.ID = core.StringPtr("testString") - updateSnapshotOptionsModel.SnapshotPatch = snapshotPatchModelAsPatch - updateSnapshotOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VolumeIdentityByID model + volumeIdentityModel := new(vpcv1.VolumeIdentityByID) + volumeIdentityModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + + // Construct an instance of the SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem model + snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel := new(vpcv1.SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem) + snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel.Name = core.StringPtr("my-snapshot") + snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel.SourceVolume = volumeIdentityModel + snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel.UserTags = []string{"testString"} + + // Construct an instance of the SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots model + snapshotConsistencyGroupPrototypeModel := new(vpcv1.SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots) + snapshotConsistencyGroupPrototypeModel.DeleteSnapshotsOnDelete = core.BoolPtr(true) + snapshotConsistencyGroupPrototypeModel.Name = core.StringPtr("my-snapshot-consistency-group") + snapshotConsistencyGroupPrototypeModel.ResourceGroup = resourceGroupIdentityModel + snapshotConsistencyGroupPrototypeModel.Snapshots = []vpcv1.SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem{*snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel} + + // Construct an instance of the CreateSnapshotConsistencyGroupOptions model + createSnapshotConsistencyGroupOptionsModel := new(vpcv1.CreateSnapshotConsistencyGroupOptions) + createSnapshotConsistencyGroupOptionsModel.SnapshotConsistencyGroupPrototype = snapshotConsistencyGroupPrototypeModel + createSnapshotConsistencyGroupOptionsModel.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.UpdateSnapshot(updateSnapshotOptionsModel) + result, response, operationErr := vpcService.CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptionsModel) 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 UpdateSnapshotOptions model with no property values - updateSnapshotOptionsModelNew := new(vpcv1.UpdateSnapshotOptions) + // Construct a second instance of the CreateSnapshotConsistencyGroupOptions model with no property values + createSnapshotConsistencyGroupOptionsModelNew := new(vpcv1.CreateSnapshotConsistencyGroupOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateSnapshot(updateSnapshotOptionsModelNew) + result, response, operationErr = vpcService.CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -53897,10 +54698,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke UpdateSnapshot successfully`, func() { + It(`Invoke CreateSnapshotConsistencyGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -53909,22 +54710,34 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the SnapshotPatch model - snapshotPatchModel := new(vpcv1.SnapshotPatch) - snapshotPatchModel.Name = core.StringPtr("my-snapshot") - snapshotPatchModel.UserTags = []string{"testString"} - snapshotPatchModelAsPatch, asPatchErr := snapshotPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - // Construct an instance of the UpdateSnapshotOptions model - updateSnapshotOptionsModel := new(vpcv1.UpdateSnapshotOptions) - updateSnapshotOptionsModel.ID = core.StringPtr("testString") - updateSnapshotOptionsModel.SnapshotPatch = snapshotPatchModelAsPatch - updateSnapshotOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VolumeIdentityByID model + volumeIdentityModel := new(vpcv1.VolumeIdentityByID) + volumeIdentityModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + + // Construct an instance of the SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem model + snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel := new(vpcv1.SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem) + snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel.Name = core.StringPtr("my-snapshot") + snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel.SourceVolume = volumeIdentityModel + snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel.UserTags = []string{"testString"} + + // Construct an instance of the SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots model + snapshotConsistencyGroupPrototypeModel := new(vpcv1.SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots) + snapshotConsistencyGroupPrototypeModel.DeleteSnapshotsOnDelete = core.BoolPtr(true) + snapshotConsistencyGroupPrototypeModel.Name = core.StringPtr("my-snapshot-consistency-group") + snapshotConsistencyGroupPrototypeModel.ResourceGroup = resourceGroupIdentityModel + snapshotConsistencyGroupPrototypeModel.Snapshots = []vpcv1.SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem{*snapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItemModel} + + // Construct an instance of the CreateSnapshotConsistencyGroupOptions model + createSnapshotConsistencyGroupOptionsModel := new(vpcv1.CreateSnapshotConsistencyGroupOptions) + createSnapshotConsistencyGroupOptionsModel.SnapshotConsistencyGroupPrototype = snapshotConsistencyGroupPrototypeModel + createSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.UpdateSnapshot(updateSnapshotOptionsModel) + result, response, operationErr := vpcService.CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -53936,25 +54749,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListSnapshotClones(listSnapshotClonesOptions *ListSnapshotClonesOptions) - Operation response error`, func() { + Describe(`DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptions *DeleteSnapshotConsistencyGroupOptions) - Operation response error`, func() { version := "testString" - listSnapshotClonesPath := "/snapshots/testString/clones" + deleteSnapshotConsistencyGroupPath := "/snapshot_consistency_groups/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(listSnapshotClonesPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deleteSnapshotConsistencyGroupPath)) + 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.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(202) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListSnapshotClones with error: Operation response processing error`, func() { + It(`Invoke DeleteSnapshotConsistencyGroup with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -53963,19 +54776,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListSnapshotClonesOptions model - listSnapshotClonesOptionsModel := new(vpcv1.ListSnapshotClonesOptions) - listSnapshotClonesOptionsModel.ID = core.StringPtr("testString") - listSnapshotClonesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteSnapshotConsistencyGroupOptions model + deleteSnapshotConsistencyGroupOptionsModel := new(vpcv1.DeleteSnapshotConsistencyGroupOptions) + deleteSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") + deleteSnapshotConsistencyGroupOptionsModel.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.ListSnapshotClones(listSnapshotClonesOptionsModel) + result, response, operationErr := vpcService.DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptionsModel) 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.ListSnapshotClones(listSnapshotClonesOptionsModel) + result, response, operationErr = vpcService.DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -53985,17 +54798,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListSnapshotClones(listSnapshotClonesOptions *ListSnapshotClonesOptions)`, func() { + Describe(`DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptions *DeleteSnapshotConsistencyGroupOptions)`, func() { version := "testString" - listSnapshotClonesPath := "/snapshots/testString/clones" + deleteSnapshotConsistencyGroupPath := "/snapshot_consistency_groups/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(listSnapshotClonesPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deleteSnapshotConsistencyGroupPath)) + 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))})) @@ -54004,11 +54817,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}]}`) + res.WriteHeader(202) + fmt.Fprintf(res, "%s", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["ServiceTags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}`) })) }) - It(`Invoke ListSnapshotClones successfully with retries`, func() { + It(`Invoke DeleteSnapshotConsistencyGroup successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -54018,21 +54831,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListSnapshotClonesOptions model - listSnapshotClonesOptionsModel := new(vpcv1.ListSnapshotClonesOptions) - listSnapshotClonesOptionsModel.ID = core.StringPtr("testString") - listSnapshotClonesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteSnapshotConsistencyGroupOptions model + deleteSnapshotConsistencyGroupOptionsModel := new(vpcv1.DeleteSnapshotConsistencyGroupOptions) + deleteSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") + deleteSnapshotConsistencyGroupOptionsModel.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.ListSnapshotClonesWithContext(ctx, listSnapshotClonesOptionsModel) + _, _, operationErr := vpcService.DeleteSnapshotConsistencyGroupWithContext(ctx, deleteSnapshotConsistencyGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListSnapshotClones(listSnapshotClonesOptionsModel) + result, response, operationErr := vpcService.DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -54040,7 +54853,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListSnapshotClonesWithContext(ctx, listSnapshotClonesOptionsModel) + _, _, operationErr = vpcService.DeleteSnapshotConsistencyGroupWithContext(ctx, deleteSnapshotConsistencyGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -54054,18 +54867,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listSnapshotClonesPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deleteSnapshotConsistencyGroupPath)) + 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))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}]}`) + res.WriteHeader(202) + fmt.Fprintf(res, "%s", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["ServiceTags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}`) })) }) - It(`Invoke ListSnapshotClones successfully`, func() { + It(`Invoke DeleteSnapshotConsistencyGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -54075,24 +54888,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListSnapshotClones(nil) + result, response, operationErr := vpcService.DeleteSnapshotConsistencyGroup(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListSnapshotClonesOptions model - listSnapshotClonesOptionsModel := new(vpcv1.ListSnapshotClonesOptions) - listSnapshotClonesOptionsModel.ID = core.StringPtr("testString") - listSnapshotClonesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteSnapshotConsistencyGroupOptions model + deleteSnapshotConsistencyGroupOptionsModel := new(vpcv1.DeleteSnapshotConsistencyGroupOptions) + deleteSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") + deleteSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListSnapshotClones(listSnapshotClonesOptionsModel) + result, response, operationErr = vpcService.DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListSnapshotClones with error: Operation validation and request error`, func() { + It(`Invoke DeleteSnapshotConsistencyGroup with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -54101,22 +54914,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListSnapshotClonesOptions model - listSnapshotClonesOptionsModel := new(vpcv1.ListSnapshotClonesOptions) - listSnapshotClonesOptionsModel.ID = core.StringPtr("testString") - listSnapshotClonesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteSnapshotConsistencyGroupOptions model + deleteSnapshotConsistencyGroupOptionsModel := new(vpcv1.DeleteSnapshotConsistencyGroupOptions) + deleteSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") + deleteSnapshotConsistencyGroupOptionsModel.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.ListSnapshotClones(listSnapshotClonesOptionsModel) + result, response, operationErr := vpcService.DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptionsModel) 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 ListSnapshotClonesOptions model with no property values - listSnapshotClonesOptionsModelNew := new(vpcv1.ListSnapshotClonesOptions) + // Construct a second instance of the DeleteSnapshotConsistencyGroupOptions model with no property values + deleteSnapshotConsistencyGroupOptionsModelNew := new(vpcv1.DeleteSnapshotConsistencyGroupOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListSnapshotClones(listSnapshotClonesOptionsModelNew) + result, response, operationErr = vpcService.DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -54131,10 +54944,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(202) })) }) - It(`Invoke ListSnapshotClones successfully`, func() { + It(`Invoke DeleteSnapshotConsistencyGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -54143,13 +54956,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListSnapshotClonesOptions model - listSnapshotClonesOptionsModel := new(vpcv1.ListSnapshotClonesOptions) - listSnapshotClonesOptionsModel.ID = core.StringPtr("testString") - listSnapshotClonesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteSnapshotConsistencyGroupOptions model + deleteSnapshotConsistencyGroupOptionsModel := new(vpcv1.DeleteSnapshotConsistencyGroupOptions) + deleteSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") + deleteSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListSnapshotClones(listSnapshotClonesOptionsModel) + result, response, operationErr := vpcService.DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -54161,91 +54974,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteSnapshotClone(deleteSnapshotCloneOptions *DeleteSnapshotCloneOptions)`, func() { - version := "testString" - deleteSnapshotClonePath := "/snapshots/testString/clones/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(deleteSnapshotClonePath)) - 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 DeleteSnapshotClone 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.DeleteSnapshotClone(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteSnapshotCloneOptions model - deleteSnapshotCloneOptionsModel := new(vpcv1.DeleteSnapshotCloneOptions) - deleteSnapshotCloneOptionsModel.ID = core.StringPtr("testString") - deleteSnapshotCloneOptionsModel.ZoneName = core.StringPtr("testString") - deleteSnapshotCloneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteSnapshotClone(deleteSnapshotCloneOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteSnapshotClone 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 DeleteSnapshotCloneOptions model - deleteSnapshotCloneOptionsModel := new(vpcv1.DeleteSnapshotCloneOptions) - deleteSnapshotCloneOptionsModel.ID = core.StringPtr("testString") - deleteSnapshotCloneOptionsModel.ZoneName = core.StringPtr("testString") - deleteSnapshotCloneOptionsModel.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.DeleteSnapshotClone(deleteSnapshotCloneOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteSnapshotCloneOptions model with no property values - deleteSnapshotCloneOptionsModelNew := new(vpcv1.DeleteSnapshotCloneOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteSnapshotClone(deleteSnapshotCloneOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetSnapshotClone(getSnapshotCloneOptions *GetSnapshotCloneOptions) - Operation response error`, func() { + Describe(`GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptions *GetSnapshotConsistencyGroupOptions) - Operation response error`, func() { version := "testString" - getSnapshotClonePath := "/snapshots/testString/clones/testString" + getSnapshotConsistencyGroupPath := "/snapshot_consistency_groups/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(getSnapshotClonePath)) + Expect(req.URL.EscapedPath()).To(Equal(getSnapshotConsistencyGroupPath)) 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))})) @@ -54254,7 +54992,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetSnapshotClone with error: Operation response processing error`, func() { + It(`Invoke GetSnapshotConsistencyGroup with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -54263,20 +55001,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetSnapshotCloneOptions model - getSnapshotCloneOptionsModel := new(vpcv1.GetSnapshotCloneOptions) - getSnapshotCloneOptionsModel.ID = core.StringPtr("testString") - getSnapshotCloneOptionsModel.ZoneName = core.StringPtr("testString") - getSnapshotCloneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSnapshotConsistencyGroupOptions model + getSnapshotConsistencyGroupOptionsModel := new(vpcv1.GetSnapshotConsistencyGroupOptions) + getSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") + getSnapshotConsistencyGroupOptionsModel.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.GetSnapshotClone(getSnapshotCloneOptionsModel) + result, response, operationErr := vpcService.GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptionsModel) 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.GetSnapshotClone(getSnapshotCloneOptionsModel) + result, response, operationErr = vpcService.GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -54286,16 +55023,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetSnapshotClone(getSnapshotCloneOptions *GetSnapshotCloneOptions)`, func() { + Describe(`GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptions *GetSnapshotConsistencyGroupOptions)`, func() { version := "testString" - getSnapshotClonePath := "/snapshots/testString/clones/testString" + getSnapshotConsistencyGroupPath := "/snapshot_consistency_groups/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(getSnapshotClonePath)) + Expect(req.URL.EscapedPath()).To(Equal(getSnapshotConsistencyGroupPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -54306,10 +55043,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "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", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["ServiceTags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}`) })) }) - It(`Invoke GetSnapshotClone successfully with retries`, func() { + It(`Invoke GetSnapshotConsistencyGroup successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -54319,22 +55056,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetSnapshotCloneOptions model - getSnapshotCloneOptionsModel := new(vpcv1.GetSnapshotCloneOptions) - getSnapshotCloneOptionsModel.ID = core.StringPtr("testString") - getSnapshotCloneOptionsModel.ZoneName = core.StringPtr("testString") - getSnapshotCloneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSnapshotConsistencyGroupOptions model + getSnapshotConsistencyGroupOptionsModel := new(vpcv1.GetSnapshotConsistencyGroupOptions) + getSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") + getSnapshotConsistencyGroupOptionsModel.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.GetSnapshotCloneWithContext(ctx, getSnapshotCloneOptionsModel) + _, _, operationErr := vpcService.GetSnapshotConsistencyGroupWithContext(ctx, getSnapshotConsistencyGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetSnapshotClone(getSnapshotCloneOptionsModel) + result, response, operationErr := vpcService.GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -54342,7 +55078,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetSnapshotCloneWithContext(ctx, getSnapshotCloneOptionsModel) + _, _, operationErr = vpcService.GetSnapshotConsistencyGroupWithContext(ctx, getSnapshotConsistencyGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -54356,7 +55092,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSnapshotClonePath)) + Expect(req.URL.EscapedPath()).To(Equal(getSnapshotConsistencyGroupPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -54364,10 +55100,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "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", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["ServiceTags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}`) })) }) - It(`Invoke GetSnapshotClone successfully`, func() { + It(`Invoke GetSnapshotConsistencyGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -54377,25 +55113,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetSnapshotClone(nil) + result, response, operationErr := vpcService.GetSnapshotConsistencyGroup(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetSnapshotCloneOptions model - getSnapshotCloneOptionsModel := new(vpcv1.GetSnapshotCloneOptions) - getSnapshotCloneOptionsModel.ID = core.StringPtr("testString") - getSnapshotCloneOptionsModel.ZoneName = core.StringPtr("testString") - getSnapshotCloneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSnapshotConsistencyGroupOptions model + getSnapshotConsistencyGroupOptionsModel := new(vpcv1.GetSnapshotConsistencyGroupOptions) + getSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") + getSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetSnapshotClone(getSnapshotCloneOptionsModel) + result, response, operationErr = vpcService.GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetSnapshotClone with error: Operation validation and request error`, func() { + It(`Invoke GetSnapshotConsistencyGroup with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -54404,23 +55139,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetSnapshotCloneOptions model - getSnapshotCloneOptionsModel := new(vpcv1.GetSnapshotCloneOptions) - getSnapshotCloneOptionsModel.ID = core.StringPtr("testString") - getSnapshotCloneOptionsModel.ZoneName = core.StringPtr("testString") - getSnapshotCloneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSnapshotConsistencyGroupOptions model + getSnapshotConsistencyGroupOptionsModel := new(vpcv1.GetSnapshotConsistencyGroupOptions) + getSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") + getSnapshotConsistencyGroupOptionsModel.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.GetSnapshotClone(getSnapshotCloneOptionsModel) + result, response, operationErr := vpcService.GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptionsModel) 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 GetSnapshotCloneOptions model with no property values - getSnapshotCloneOptionsModelNew := new(vpcv1.GetSnapshotCloneOptions) + // Construct a second instance of the GetSnapshotConsistencyGroupOptions model with no property values + getSnapshotConsistencyGroupOptionsModelNew := new(vpcv1.GetSnapshotConsistencyGroupOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetSnapshotClone(getSnapshotCloneOptionsModelNew) + result, response, operationErr = vpcService.GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -54438,7 +55172,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetSnapshotClone successfully`, func() { + It(`Invoke GetSnapshotConsistencyGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -54447,14 +55181,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetSnapshotCloneOptions model - getSnapshotCloneOptionsModel := new(vpcv1.GetSnapshotCloneOptions) - getSnapshotCloneOptionsModel.ID = core.StringPtr("testString") - getSnapshotCloneOptionsModel.ZoneName = core.StringPtr("testString") - getSnapshotCloneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSnapshotConsistencyGroupOptions model + getSnapshotConsistencyGroupOptionsModel := new(vpcv1.GetSnapshotConsistencyGroupOptions) + getSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") + getSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetSnapshotClone(getSnapshotCloneOptionsModel) + result, response, operationErr := vpcService.GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -54466,17 +55199,19 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateSnapshotClone(createSnapshotCloneOptions *CreateSnapshotCloneOptions) - Operation response error`, func() { + Describe(`UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptions *UpdateSnapshotConsistencyGroupOptions) - Operation response error`, func() { version := "testString" - createSnapshotClonePath := "/snapshots/testString/clones/testString" + updateSnapshotConsistencyGroupPath := "/snapshot_consistency_groups/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(createSnapshotClonePath)) - Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.EscapedPath()).To(Equal(updateSnapshotConsistencyGroupPath)) + 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") @@ -54484,7 +55219,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateSnapshotClone with error: Operation response processing error`, func() { + It(`Invoke UpdateSnapshotConsistencyGroup with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -54493,20 +55228,28 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the CreateSnapshotCloneOptions model - createSnapshotCloneOptionsModel := new(vpcv1.CreateSnapshotCloneOptions) - createSnapshotCloneOptionsModel.ID = core.StringPtr("testString") - createSnapshotCloneOptionsModel.ZoneName = core.StringPtr("testString") - createSnapshotCloneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SnapshotConsistencyGroupPatch model + snapshotConsistencyGroupPatchModel := new(vpcv1.SnapshotConsistencyGroupPatch) + snapshotConsistencyGroupPatchModel.DeleteSnapshotsOnDelete = core.BoolPtr(true) + snapshotConsistencyGroupPatchModel.Name = core.StringPtr("my-snapshot-consistency-group") + snapshotConsistencyGroupPatchModelAsPatch, asPatchErr := snapshotConsistencyGroupPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateSnapshotConsistencyGroupOptions model + updateSnapshotConsistencyGroupOptionsModel := new(vpcv1.UpdateSnapshotConsistencyGroupOptions) + updateSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") + updateSnapshotConsistencyGroupOptionsModel.SnapshotConsistencyGroupPatch = snapshotConsistencyGroupPatchModelAsPatch + updateSnapshotConsistencyGroupOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateSnapshotConsistencyGroupOptionsModel.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.CreateSnapshotClone(createSnapshotCloneOptionsModel) + result, response, operationErr := vpcService.UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptionsModel) 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.CreateSnapshotClone(createSnapshotCloneOptionsModel) + result, response, operationErr = vpcService.UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -54516,18 +55259,36 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateSnapshotClone(createSnapshotCloneOptions *CreateSnapshotCloneOptions)`, func() { + Describe(`UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptions *UpdateSnapshotConsistencyGroupOptions)`, func() { version := "testString" - createSnapshotClonePath := "/snapshots/testString/clones/testString" + updateSnapshotConsistencyGroupPath := "/snapshot_consistency_groups/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(createSnapshotClonePath)) - Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.EscapedPath()).To(Equal(updateSnapshotConsistencyGroupPath)) + 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 @@ -54536,10 +55297,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "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", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["ServiceTags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}`) })) }) - It(`Invoke CreateSnapshotClone successfully with retries`, func() { + It(`Invoke UpdateSnapshotConsistencyGroup successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -54549,22 +55310,30 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the CreateSnapshotCloneOptions model - createSnapshotCloneOptionsModel := new(vpcv1.CreateSnapshotCloneOptions) - createSnapshotCloneOptionsModel.ID = core.StringPtr("testString") - createSnapshotCloneOptionsModel.ZoneName = core.StringPtr("testString") - createSnapshotCloneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SnapshotConsistencyGroupPatch model + snapshotConsistencyGroupPatchModel := new(vpcv1.SnapshotConsistencyGroupPatch) + snapshotConsistencyGroupPatchModel.DeleteSnapshotsOnDelete = core.BoolPtr(true) + snapshotConsistencyGroupPatchModel.Name = core.StringPtr("my-snapshot-consistency-group") + snapshotConsistencyGroupPatchModelAsPatch, asPatchErr := snapshotConsistencyGroupPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateSnapshotConsistencyGroupOptions model + updateSnapshotConsistencyGroupOptionsModel := new(vpcv1.UpdateSnapshotConsistencyGroupOptions) + updateSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") + updateSnapshotConsistencyGroupOptionsModel.SnapshotConsistencyGroupPatch = snapshotConsistencyGroupPatchModelAsPatch + updateSnapshotConsistencyGroupOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateSnapshotConsistencyGroupOptionsModel.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.CreateSnapshotCloneWithContext(ctx, createSnapshotCloneOptionsModel) + _, _, operationErr := vpcService.UpdateSnapshotConsistencyGroupWithContext(ctx, updateSnapshotConsistencyGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateSnapshotClone(createSnapshotCloneOptionsModel) + result, response, operationErr := vpcService.UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -54572,7 +55341,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreateSnapshotCloneWithContext(ctx, createSnapshotCloneOptionsModel) + _, _, operationErr = vpcService.UpdateSnapshotConsistencyGroupWithContext(ctx, updateSnapshotConsistencyGroupOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -54586,46 +55355,72 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createSnapshotClonePath)) - Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.EscapedPath()).To(Equal(updateSnapshotConsistencyGroupPath)) + 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))})) - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) - })) - }) - It(`Invoke CreateSnapshotClone successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) + // 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", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "delete_snapshots_on_delete": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "name": "my-snapshot-consistency-group", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot_consistency_group", "service_tags": ["ServiceTags"], "snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}]}`) + })) + }) + It(`Invoke UpdateSnapshotConsistencyGroup 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.CreateSnapshotClone(nil) + result, response, operationErr := vpcService.UpdateSnapshotConsistencyGroup(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the CreateSnapshotCloneOptions model - createSnapshotCloneOptionsModel := new(vpcv1.CreateSnapshotCloneOptions) - createSnapshotCloneOptionsModel.ID = core.StringPtr("testString") - createSnapshotCloneOptionsModel.ZoneName = core.StringPtr("testString") - createSnapshotCloneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SnapshotConsistencyGroupPatch model + snapshotConsistencyGroupPatchModel := new(vpcv1.SnapshotConsistencyGroupPatch) + snapshotConsistencyGroupPatchModel.DeleteSnapshotsOnDelete = core.BoolPtr(true) + snapshotConsistencyGroupPatchModel.Name = core.StringPtr("my-snapshot-consistency-group") + snapshotConsistencyGroupPatchModelAsPatch, asPatchErr := snapshotConsistencyGroupPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateSnapshotConsistencyGroupOptions model + updateSnapshotConsistencyGroupOptionsModel := new(vpcv1.UpdateSnapshotConsistencyGroupOptions) + updateSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") + updateSnapshotConsistencyGroupOptionsModel.SnapshotConsistencyGroupPatch = snapshotConsistencyGroupPatchModelAsPatch + updateSnapshotConsistencyGroupOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateSnapshotClone(createSnapshotCloneOptionsModel) + result, response, operationErr = vpcService.UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateSnapshotClone with error: Operation validation and request error`, func() { + It(`Invoke UpdateSnapshotConsistencyGroup with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -54634,23 +55429,31 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the CreateSnapshotCloneOptions model - createSnapshotCloneOptionsModel := new(vpcv1.CreateSnapshotCloneOptions) - createSnapshotCloneOptionsModel.ID = core.StringPtr("testString") - createSnapshotCloneOptionsModel.ZoneName = core.StringPtr("testString") - createSnapshotCloneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SnapshotConsistencyGroupPatch model + snapshotConsistencyGroupPatchModel := new(vpcv1.SnapshotConsistencyGroupPatch) + snapshotConsistencyGroupPatchModel.DeleteSnapshotsOnDelete = core.BoolPtr(true) + snapshotConsistencyGroupPatchModel.Name = core.StringPtr("my-snapshot-consistency-group") + snapshotConsistencyGroupPatchModelAsPatch, asPatchErr := snapshotConsistencyGroupPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateSnapshotConsistencyGroupOptions model + updateSnapshotConsistencyGroupOptionsModel := new(vpcv1.UpdateSnapshotConsistencyGroupOptions) + updateSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") + updateSnapshotConsistencyGroupOptionsModel.SnapshotConsistencyGroupPatch = snapshotConsistencyGroupPatchModelAsPatch + updateSnapshotConsistencyGroupOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateSnapshotConsistencyGroupOptionsModel.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.CreateSnapshotClone(createSnapshotCloneOptionsModel) + result, response, operationErr := vpcService.UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptionsModel) 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 CreateSnapshotCloneOptions model with no property values - createSnapshotCloneOptionsModelNew := new(vpcv1.CreateSnapshotCloneOptions) + // Construct a second instance of the UpdateSnapshotConsistencyGroupOptions model with no property values + updateSnapshotConsistencyGroupOptionsModelNew := new(vpcv1.UpdateSnapshotConsistencyGroupOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateSnapshotClone(createSnapshotCloneOptionsModelNew) + result, response, operationErr = vpcService.UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -54668,7 +55471,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke CreateSnapshotClone successfully`, func() { + It(`Invoke UpdateSnapshotConsistencyGroup successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -54677,14 +55480,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the CreateSnapshotCloneOptions model - createSnapshotCloneOptionsModel := new(vpcv1.CreateSnapshotCloneOptions) - createSnapshotCloneOptionsModel.ID = core.StringPtr("testString") - createSnapshotCloneOptionsModel.ZoneName = core.StringPtr("testString") - createSnapshotCloneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SnapshotConsistencyGroupPatch model + snapshotConsistencyGroupPatchModel := new(vpcv1.SnapshotConsistencyGroupPatch) + snapshotConsistencyGroupPatchModel.DeleteSnapshotsOnDelete = core.BoolPtr(true) + snapshotConsistencyGroupPatchModel.Name = core.StringPtr("my-snapshot-consistency-group") + snapshotConsistencyGroupPatchModelAsPatch, asPatchErr := snapshotConsistencyGroupPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateSnapshotConsistencyGroupOptions model + updateSnapshotConsistencyGroupOptionsModel := new(vpcv1.UpdateSnapshotConsistencyGroupOptions) + updateSnapshotConsistencyGroupOptionsModel.ID = core.StringPtr("testString") + updateSnapshotConsistencyGroupOptionsModel.SnapshotConsistencyGroupPatch = snapshotConsistencyGroupPatchModelAsPatch + updateSnapshotConsistencyGroupOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateSnapshotConsistencyGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.CreateSnapshotClone(createSnapshotCloneOptionsModel) + result, response, operationErr := vpcService.UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -54696,28 +55507,121 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListShareProfiles(listShareProfilesOptions *ListShareProfilesOptions) - Operation response error`, func() { + Describe(`DeleteSnapshots(deleteSnapshotsOptions *DeleteSnapshotsOptions)`, func() { version := "testString" - listShareProfilesPath := "/share/profiles" + deleteSnapshotsPath := "/snapshots" + 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(deleteSnapshotsPath)) + 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))})) + Expect(req.URL.Query()["source_volume.id"]).To(Equal([]string{"testString"})) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteSnapshots 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.DeleteSnapshots(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteSnapshotsOptions model + deleteSnapshotsOptionsModel := new(vpcv1.DeleteSnapshotsOptions) + deleteSnapshotsOptionsModel.SourceVolumeID = core.StringPtr("testString") + deleteSnapshotsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteSnapshots(deleteSnapshotsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteSnapshots 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 DeleteSnapshotsOptions model + deleteSnapshotsOptionsModel := new(vpcv1.DeleteSnapshotsOptions) + deleteSnapshotsOptionsModel.SourceVolumeID = core.StringPtr("testString") + deleteSnapshotsOptionsModel.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.DeleteSnapshots(deleteSnapshotsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteSnapshotsOptions model with no property values + deleteSnapshotsOptionsModelNew := new(vpcv1.DeleteSnapshotsOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteSnapshots(deleteSnapshotsOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListSnapshots(listSnapshotsOptions *ListSnapshotsOptions) - Operation response error`, func() { + version := "testString" + listSnapshotsPath := "/snapshots" 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(listShareProfilesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listSnapshotsPath)) 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(10))})) + Expect(req.URL.Query()["tag"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["source_volume.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["source_volume.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5"})) + Expect(req.URL.Query()["source_image.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["source_image.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"})) Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) + Expect(req.URL.Query()["backup_policy_plan.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["copies[].id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["copies[].name"]).To(Equal([]string{"my-snapshot-copy"})) + Expect(req.URL.Query()["copies[].crn"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["copies[].remote.region.name"]).To(Equal([]string{"us-south"})) + Expect(req.URL.Query()["source_snapshot.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["source_snapshot.remote.region.name"]).To(Equal([]string{"us-south"})) + Expect(req.URL.Query()["source_volume.remote.region.name"]).To(Equal([]string{"us-south"})) + Expect(req.URL.Query()["source_image.remote.region.name"]).To(Equal([]string{"us-south"})) + Expect(req.URL.Query()["clones[].zone.name"]).To(Equal([]string{"us-south-1"})) + Expect(req.URL.Query()["snapshot_consistency_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["snapshot_consistency_group.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListShareProfiles with error: Operation response processing error`, func() { + It(`Invoke ListSnapshots with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -54726,21 +55630,40 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListShareProfilesOptions model - listShareProfilesOptionsModel := new(vpcv1.ListShareProfilesOptions) - listShareProfilesOptionsModel.Start = core.StringPtr("testString") - listShareProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listShareProfilesOptionsModel.Sort = core.StringPtr("name") - listShareProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSnapshotsOptions model + listSnapshotsOptionsModel := new(vpcv1.ListSnapshotsOptions) + listSnapshotsOptionsModel.Start = core.StringPtr("testString") + listSnapshotsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listSnapshotsOptionsModel.Tag = core.StringPtr("testString") + listSnapshotsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSnapshotsOptionsModel.Name = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceVolumeID = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceVolumeCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + listSnapshotsOptionsModel.SourceImageID = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceImageCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") + listSnapshotsOptionsModel.Sort = core.StringPtr("name") + listSnapshotsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") + listSnapshotsOptionsModel.CopiesID = core.StringPtr("testString") + listSnapshotsOptionsModel.CopiesName = core.StringPtr("my-snapshot-copy") + listSnapshotsOptionsModel.CopiesCRN = core.StringPtr("testString") + listSnapshotsOptionsModel.CopiesRemoteRegionName = core.StringPtr("us-south") + listSnapshotsOptionsModel.SourceSnapshotID = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceSnapshotRemoteRegionName = core.StringPtr("us-south") + listSnapshotsOptionsModel.SourceVolumeRemoteRegionName = core.StringPtr("us-south") + listSnapshotsOptionsModel.SourceImageRemoteRegionName = core.StringPtr("us-south") + listSnapshotsOptionsModel.ClonesZoneName = core.StringPtr("us-south-1") + listSnapshotsOptionsModel.SnapshotConsistencyGroupID = core.StringPtr("testString") + listSnapshotsOptionsModel.SnapshotConsistencyGroupCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263") + listSnapshotsOptionsModel.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.ListShareProfiles(listShareProfilesOptionsModel) + result, response, operationErr := vpcService.ListSnapshots(listSnapshotsOptionsModel) 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.ListShareProfiles(listShareProfilesOptionsModel) + result, response, operationErr = vpcService.ListSnapshots(listSnapshotsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -54750,33 +55673,52 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListShareProfiles(listShareProfilesOptions *ListShareProfilesOptions)`, func() { + Describe(`ListSnapshots(listSnapshotsOptions *ListSnapshotsOptions)`, func() { version := "testString" - listShareProfilesPath := "/share/profiles" + listSnapshotsPath := "/snapshots" 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(listShareProfilesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listSnapshotsPath)) 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(10))})) + Expect(req.URL.Query()["tag"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["source_volume.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["source_volume.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5"})) + Expect(req.URL.Query()["source_image.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["source_image.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"})) Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) + Expect(req.URL.Query()["backup_policy_plan.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["copies[].id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["copies[].name"]).To(Equal([]string{"my-snapshot-copy"})) + Expect(req.URL.Query()["copies[].crn"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["copies[].remote.region.name"]).To(Equal([]string{"us-south"})) + Expect(req.URL.Query()["source_snapshot.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["source_snapshot.remote.region.name"]).To(Equal([]string{"us-south"})) + Expect(req.URL.Query()["source_volume.remote.region.name"]).To(Equal([]string{"us-south"})) + Expect(req.URL.Query()["source_image.remote.region.name"]).To(Equal([]string{"us-south"})) + Expect(req.URL.Query()["clones[].zone.name"]).To(Equal([]string{"us-south-1"})) + Expect(req.URL.Query()["snapshot_consistency_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["snapshot_consistency_group.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263"})) // 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/share/profiles?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "profiles": [{"capacity": {"type": "fixed", "value": 4800}, "family": "defined_performance", "href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "iops": {"type": "fixed", "value": 4000}, "name": "tier-3iops", "resource_type": "share_profile"}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "snapshots": [{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["ServiceTags"], "size": 1, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "user_tags": ["UserTags"]}], "total_count": 132}`) })) }) - It(`Invoke ListShareProfiles successfully with retries`, func() { + It(`Invoke ListSnapshots successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -54786,23 +55728,42 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListShareProfilesOptions model - listShareProfilesOptionsModel := new(vpcv1.ListShareProfilesOptions) - listShareProfilesOptionsModel.Start = core.StringPtr("testString") - listShareProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listShareProfilesOptionsModel.Sort = core.StringPtr("name") - listShareProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSnapshotsOptions model + listSnapshotsOptionsModel := new(vpcv1.ListSnapshotsOptions) + listSnapshotsOptionsModel.Start = core.StringPtr("testString") + listSnapshotsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listSnapshotsOptionsModel.Tag = core.StringPtr("testString") + listSnapshotsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSnapshotsOptionsModel.Name = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceVolumeID = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceVolumeCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + listSnapshotsOptionsModel.SourceImageID = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceImageCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") + listSnapshotsOptionsModel.Sort = core.StringPtr("name") + listSnapshotsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") + listSnapshotsOptionsModel.CopiesID = core.StringPtr("testString") + listSnapshotsOptionsModel.CopiesName = core.StringPtr("my-snapshot-copy") + listSnapshotsOptionsModel.CopiesCRN = core.StringPtr("testString") + listSnapshotsOptionsModel.CopiesRemoteRegionName = core.StringPtr("us-south") + listSnapshotsOptionsModel.SourceSnapshotID = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceSnapshotRemoteRegionName = core.StringPtr("us-south") + listSnapshotsOptionsModel.SourceVolumeRemoteRegionName = core.StringPtr("us-south") + listSnapshotsOptionsModel.SourceImageRemoteRegionName = core.StringPtr("us-south") + listSnapshotsOptionsModel.ClonesZoneName = core.StringPtr("us-south-1") + listSnapshotsOptionsModel.SnapshotConsistencyGroupID = core.StringPtr("testString") + listSnapshotsOptionsModel.SnapshotConsistencyGroupCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263") + listSnapshotsOptionsModel.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.ListShareProfilesWithContext(ctx, listShareProfilesOptionsModel) + _, _, operationErr := vpcService.ListSnapshotsWithContext(ctx, listSnapshotsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListShareProfiles(listShareProfilesOptionsModel) + result, response, operationErr := vpcService.ListSnapshots(listSnapshotsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -54810,7 +55771,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListShareProfilesWithContext(ctx, listShareProfilesOptionsModel) + _, _, operationErr = vpcService.ListSnapshotsWithContext(ctx, listSnapshotsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -54824,21 +55785,40 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listShareProfilesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listSnapshotsPath)) 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(10))})) + Expect(req.URL.Query()["tag"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["source_volume.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["source_volume.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5"})) + Expect(req.URL.Query()["source_image.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["source_image.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"})) Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) + Expect(req.URL.Query()["backup_policy_plan.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["copies[].id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["copies[].name"]).To(Equal([]string{"my-snapshot-copy"})) + Expect(req.URL.Query()["copies[].crn"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["copies[].remote.region.name"]).To(Equal([]string{"us-south"})) + Expect(req.URL.Query()["source_snapshot.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["source_snapshot.remote.region.name"]).To(Equal([]string{"us-south"})) + Expect(req.URL.Query()["source_volume.remote.region.name"]).To(Equal([]string{"us-south"})) + Expect(req.URL.Query()["source_image.remote.region.name"]).To(Equal([]string{"us-south"})) + Expect(req.URL.Query()["clones[].zone.name"]).To(Equal([]string{"us-south-1"})) + Expect(req.URL.Query()["snapshot_consistency_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["snapshot_consistency_group.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263"})) // 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/share/profiles?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "profiles": [{"capacity": {"type": "fixed", "value": 4800}, "family": "defined_performance", "href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "iops": {"type": "fixed", "value": 4000}, "name": "tier-3iops", "resource_type": "share_profile"}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "snapshots": [{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["ServiceTags"], "size": 1, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "user_tags": ["UserTags"]}], "total_count": 132}`) })) }) - It(`Invoke ListShareProfiles successfully`, func() { + It(`Invoke ListSnapshots successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -54848,26 +55828,45 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListShareProfiles(nil) + result, response, operationErr := vpcService.ListSnapshots(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListShareProfilesOptions model - listShareProfilesOptionsModel := new(vpcv1.ListShareProfilesOptions) - listShareProfilesOptionsModel.Start = core.StringPtr("testString") - listShareProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listShareProfilesOptionsModel.Sort = core.StringPtr("name") - listShareProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSnapshotsOptions model + listSnapshotsOptionsModel := new(vpcv1.ListSnapshotsOptions) + listSnapshotsOptionsModel.Start = core.StringPtr("testString") + listSnapshotsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listSnapshotsOptionsModel.Tag = core.StringPtr("testString") + listSnapshotsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSnapshotsOptionsModel.Name = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceVolumeID = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceVolumeCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + listSnapshotsOptionsModel.SourceImageID = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceImageCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") + listSnapshotsOptionsModel.Sort = core.StringPtr("name") + listSnapshotsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") + listSnapshotsOptionsModel.CopiesID = core.StringPtr("testString") + listSnapshotsOptionsModel.CopiesName = core.StringPtr("my-snapshot-copy") + listSnapshotsOptionsModel.CopiesCRN = core.StringPtr("testString") + listSnapshotsOptionsModel.CopiesRemoteRegionName = core.StringPtr("us-south") + listSnapshotsOptionsModel.SourceSnapshotID = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceSnapshotRemoteRegionName = core.StringPtr("us-south") + listSnapshotsOptionsModel.SourceVolumeRemoteRegionName = core.StringPtr("us-south") + listSnapshotsOptionsModel.SourceImageRemoteRegionName = core.StringPtr("us-south") + listSnapshotsOptionsModel.ClonesZoneName = core.StringPtr("us-south-1") + listSnapshotsOptionsModel.SnapshotConsistencyGroupID = core.StringPtr("testString") + listSnapshotsOptionsModel.SnapshotConsistencyGroupCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263") + listSnapshotsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListShareProfiles(listShareProfilesOptionsModel) + result, response, operationErr = vpcService.ListSnapshots(listSnapshotsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListShareProfiles with error: Operation request error`, func() { + It(`Invoke ListSnapshots with error: Operation request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -54876,16 +55875,35 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListShareProfilesOptions model - listShareProfilesOptionsModel := new(vpcv1.ListShareProfilesOptions) - listShareProfilesOptionsModel.Start = core.StringPtr("testString") - listShareProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listShareProfilesOptionsModel.Sort = core.StringPtr("name") - listShareProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSnapshotsOptions model + listSnapshotsOptionsModel := new(vpcv1.ListSnapshotsOptions) + listSnapshotsOptionsModel.Start = core.StringPtr("testString") + listSnapshotsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listSnapshotsOptionsModel.Tag = core.StringPtr("testString") + listSnapshotsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSnapshotsOptionsModel.Name = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceVolumeID = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceVolumeCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + listSnapshotsOptionsModel.SourceImageID = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceImageCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") + listSnapshotsOptionsModel.Sort = core.StringPtr("name") + listSnapshotsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") + listSnapshotsOptionsModel.CopiesID = core.StringPtr("testString") + listSnapshotsOptionsModel.CopiesName = core.StringPtr("my-snapshot-copy") + listSnapshotsOptionsModel.CopiesCRN = core.StringPtr("testString") + listSnapshotsOptionsModel.CopiesRemoteRegionName = core.StringPtr("us-south") + listSnapshotsOptionsModel.SourceSnapshotID = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceSnapshotRemoteRegionName = core.StringPtr("us-south") + listSnapshotsOptionsModel.SourceVolumeRemoteRegionName = core.StringPtr("us-south") + listSnapshotsOptionsModel.SourceImageRemoteRegionName = core.StringPtr("us-south") + listSnapshotsOptionsModel.ClonesZoneName = core.StringPtr("us-south-1") + listSnapshotsOptionsModel.SnapshotConsistencyGroupID = core.StringPtr("testString") + listSnapshotsOptionsModel.SnapshotConsistencyGroupCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263") + listSnapshotsOptionsModel.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.ListShareProfiles(listShareProfilesOptionsModel) + result, response, operationErr := vpcService.ListSnapshots(listSnapshotsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) @@ -54904,7 +55922,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListShareProfiles successfully`, func() { + It(`Invoke ListSnapshots successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -54913,15 +55931,34 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListShareProfilesOptions model - listShareProfilesOptionsModel := new(vpcv1.ListShareProfilesOptions) - listShareProfilesOptionsModel.Start = core.StringPtr("testString") - listShareProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listShareProfilesOptionsModel.Sort = core.StringPtr("name") - listShareProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSnapshotsOptions model + listSnapshotsOptionsModel := new(vpcv1.ListSnapshotsOptions) + listSnapshotsOptionsModel.Start = core.StringPtr("testString") + listSnapshotsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listSnapshotsOptionsModel.Tag = core.StringPtr("testString") + listSnapshotsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSnapshotsOptionsModel.Name = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceVolumeID = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceVolumeCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + listSnapshotsOptionsModel.SourceImageID = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceImageCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") + listSnapshotsOptionsModel.Sort = core.StringPtr("name") + listSnapshotsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") + listSnapshotsOptionsModel.CopiesID = core.StringPtr("testString") + listSnapshotsOptionsModel.CopiesName = core.StringPtr("my-snapshot-copy") + listSnapshotsOptionsModel.CopiesCRN = core.StringPtr("testString") + listSnapshotsOptionsModel.CopiesRemoteRegionName = core.StringPtr("us-south") + listSnapshotsOptionsModel.SourceSnapshotID = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceSnapshotRemoteRegionName = core.StringPtr("us-south") + listSnapshotsOptionsModel.SourceVolumeRemoteRegionName = core.StringPtr("us-south") + listSnapshotsOptionsModel.SourceImageRemoteRegionName = core.StringPtr("us-south") + listSnapshotsOptionsModel.ClonesZoneName = core.StringPtr("us-south-1") + listSnapshotsOptionsModel.SnapshotConsistencyGroupID = core.StringPtr("testString") + listSnapshotsOptionsModel.SnapshotConsistencyGroupCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263") + listSnapshotsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListShareProfiles(listShareProfilesOptionsModel) + result, response, operationErr := vpcService.ListSnapshots(listSnapshotsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -54934,8 +55971,8 @@ var _ = Describe(`VpcV1`, func() { }) Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.ShareProfileCollection) - nextObject := new(vpcv1.ShareProfileCollectionNext) + responseObject := new(vpcv1.SnapshotCollection) + nextObject := new(vpcv1.SnapshotCollectionNext) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -54944,15 +55981,15 @@ var _ = Describe(`VpcV1`, func() { Expect(value).To(Equal(core.StringPtr("abc-123"))) }) It(`Invoke GetNextStart without a "Next" property in the response`, func() { - responseObject := new(vpcv1.ShareProfileCollection) + responseObject := new(vpcv1.SnapshotCollection) 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.ShareProfileCollection) - nextObject := new(vpcv1.ShareProfileCollectionNext) + responseObject := new(vpcv1.SnapshotCollection) + nextObject := new(vpcv1.SnapshotCollectionNext) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -54968,7 +56005,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listShareProfilesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listSnapshotsPath)) Expect(req.Method).To(Equal("GET")) // Set mock response @@ -54976,15 +56013,15 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) requestNumber++ if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"profiles":[{"capacity":{"type":"fixed","value":4800},"family":"defined_performance","href":"https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops","iops":{"type":"fixed","value":4000},"name":"tier-3iops","resource_type":"share_profile"}]}`) + fmt.Fprintf(res, "%s", `{"snapshots":[{"backup_policy_plan":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"bootable":true,"captured_at":"2019-01-01T12:00:00.000Z","clones":[{"available":false,"created_at":"2019-01-01T12:00:00.000Z","zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"copies":[{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}],"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deletable":false,"encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","lifecycle_state":"stable","minimum_capacity":1,"name":"my-snapshot","operating_system":{"architecture":"amd64","dedicated_host_only":false,"display_name":"Ubuntu Server 16.04 LTS amd64","family":"Ubuntu Server","href":"https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64","name":"ubuntu-16-amd64","vendor":"Canonical","version":"16.04 LTS"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"snapshot","service_tags":["ServiceTags"],"size":1,"snapshot_consistency_group":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263","id":"r134-fa329f6b-0e36-433f-a3bb-0df632e79263","name":"my-snapshot-consistency-group","resource_type":"snapshot_consistency_group"},"source_image":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"aa2432b1fa4d4ace891e9b80fc104e34","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"},"source_volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"volume"},"user_tags":["UserTags"]}],"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1}`) } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"profiles":[{"capacity":{"type":"fixed","value":4800},"family":"defined_performance","href":"https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops","iops":{"type":"fixed","value":4000},"name":"tier-3iops","resource_type":"share_profile"}]}`) + fmt.Fprintf(res, "%s", `{"snapshots":[{"backup_policy_plan":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","id":"r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178","name":"my-policy-plan","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"backup_policy_plan"},"bootable":true,"captured_at":"2019-01-01T12:00:00.000Z","clones":[{"available":false,"created_at":"2019-01-01T12:00:00.000Z","zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"copies":[{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"}],"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deletable":false,"encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","lifecycle_state":"stable","minimum_capacity":1,"name":"my-snapshot","operating_system":{"architecture":"amd64","dedicated_host_only":false,"display_name":"Ubuntu Server 16.04 LTS amd64","family":"Ubuntu Server","href":"https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64","name":"ubuntu-16-amd64","vendor":"Canonical","version":"16.04 LTS"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"snapshot","service_tags":["ServiceTags"],"size":1,"snapshot_consistency_group":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263","id":"r134-fa329f6b-0e36-433f-a3bb-0df632e79263","name":"my-snapshot-consistency-group","resource_type":"snapshot_consistency_group"},"source_image":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image","remote":{"account":{"id":"aa2432b1fa4d4ace891e9b80fc104e34","resource_type":"account"},"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"image"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263","id":"r134-f6bfa329-0e36-433f-a3bb-0df632e79263","name":"my-snapshot","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"snapshot"},"source_volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"volume"},"user_tags":["UserTags"]}],"total_count":2,"limit":1}`) } else { res.WriteHeader(400) } })) }) - It(`Use ShareProfilesPager.GetNext successfully`, func() { + It(`Use SnapshotsPager.GetNext successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -54993,16 +56030,35 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listShareProfilesOptionsModel := &vpcv1.ListShareProfilesOptions{ - Limit: core.Int64Ptr(int64(10)), - Sort: core.StringPtr("name"), + listSnapshotsOptionsModel := &vpcv1.ListSnapshotsOptions{ + Limit: core.Int64Ptr(int64(10)), + Tag: core.StringPtr("testString"), + ResourceGroupID: core.StringPtr("testString"), + Name: core.StringPtr("testString"), + SourceVolumeID: core.StringPtr("testString"), + SourceVolumeCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5"), + SourceImageID: core.StringPtr("testString"), + SourceImageCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"), + Sort: core.StringPtr("name"), + BackupPolicyPlanID: core.StringPtr("testString"), + CopiesID: core.StringPtr("testString"), + CopiesName: core.StringPtr("my-snapshot-copy"), + CopiesCRN: core.StringPtr("testString"), + CopiesRemoteRegionName: core.StringPtr("us-south"), + SourceSnapshotID: core.StringPtr("testString"), + SourceSnapshotRemoteRegionName: core.StringPtr("us-south"), + SourceVolumeRemoteRegionName: core.StringPtr("us-south"), + SourceImageRemoteRegionName: core.StringPtr("us-south"), + ClonesZoneName: core.StringPtr("us-south-1"), + SnapshotConsistencyGroupID: core.StringPtr("testString"), + SnapshotConsistencyGroupCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263"), } - pager, err := vpcService.NewShareProfilesPager(listShareProfilesOptionsModel) + pager, err := vpcService.NewSnapshotsPager(listSnapshotsOptionsModel) Expect(err).To(BeNil()) Expect(pager).ToNot(BeNil()) - var allResults []vpcv1.ShareProfile + var allResults []vpcv1.Snapshot for pager.HasNext() { nextPage, err := pager.GetNext() Expect(err).To(BeNil()) @@ -55011,7 +56067,7 @@ var _ = Describe(`VpcV1`, func() { } Expect(len(allResults)).To(Equal(2)) }) - It(`Use ShareProfilesPager.GetAll successfully`, func() { + It(`Use SnapshotsPager.GetAll successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -55020,12 +56076,31 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listShareProfilesOptionsModel := &vpcv1.ListShareProfilesOptions{ - Limit: core.Int64Ptr(int64(10)), - Sort: core.StringPtr("name"), + listSnapshotsOptionsModel := &vpcv1.ListSnapshotsOptions{ + Limit: core.Int64Ptr(int64(10)), + Tag: core.StringPtr("testString"), + ResourceGroupID: core.StringPtr("testString"), + Name: core.StringPtr("testString"), + SourceVolumeID: core.StringPtr("testString"), + SourceVolumeCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5"), + SourceImageID: core.StringPtr("testString"), + SourceImageCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"), + Sort: core.StringPtr("name"), + BackupPolicyPlanID: core.StringPtr("testString"), + CopiesID: core.StringPtr("testString"), + CopiesName: core.StringPtr("my-snapshot-copy"), + CopiesCRN: core.StringPtr("testString"), + CopiesRemoteRegionName: core.StringPtr("us-south"), + SourceSnapshotID: core.StringPtr("testString"), + SourceSnapshotRemoteRegionName: core.StringPtr("us-south"), + SourceVolumeRemoteRegionName: core.StringPtr("us-south"), + SourceImageRemoteRegionName: core.StringPtr("us-south"), + ClonesZoneName: core.StringPtr("us-south-1"), + SnapshotConsistencyGroupID: core.StringPtr("testString"), + SnapshotConsistencyGroupCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263"), } - pager, err := vpcService.NewShareProfilesPager(listShareProfilesOptionsModel) + pager, err := vpcService.NewSnapshotsPager(listSnapshotsOptionsModel) Expect(err).To(BeNil()) Expect(pager).ToNot(BeNil()) @@ -55036,25 +56111,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetShareProfile(getShareProfileOptions *GetShareProfileOptions) - Operation response error`, func() { + Describe(`CreateSnapshot(createSnapshotOptions *CreateSnapshotOptions) - Operation response error`, func() { version := "testString" - getShareProfilePath := "/share/profiles/testString" + createSnapshotPath := "/snapshots" 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(getShareProfilePath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createSnapshotPath)) + 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(200) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetShareProfile with error: Operation response processing error`, func() { + It(`Invoke CreateSnapshot with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -55063,19 +56138,43 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetShareProfileOptions model - getShareProfileOptionsModel := new(vpcv1.GetShareProfileOptions) - getShareProfileOptionsModel.Name = core.StringPtr("testString") - getShareProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the SnapshotClonePrototype model + snapshotClonePrototypeModel := new(vpcv1.SnapshotClonePrototype) + snapshotClonePrototypeModel.Zone = zoneIdentityModel + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the VolumeIdentityByID model + volumeIdentityModel := new(vpcv1.VolumeIdentityByID) + volumeIdentityModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + + // Construct an instance of the SnapshotPrototypeSnapshotBySourceVolume model + snapshotPrototypeModel := new(vpcv1.SnapshotPrototypeSnapshotBySourceVolume) + snapshotPrototypeModel.Clones = []vpcv1.SnapshotClonePrototype{*snapshotClonePrototypeModel} + snapshotPrototypeModel.Name = core.StringPtr("my-snapshot") + snapshotPrototypeModel.ResourceGroup = resourceGroupIdentityModel + snapshotPrototypeModel.UserTags = []string{} + snapshotPrototypeModel.SourceVolume = volumeIdentityModel + + // Construct an instance of the CreateSnapshotOptions model + createSnapshotOptionsModel := new(vpcv1.CreateSnapshotOptions) + createSnapshotOptionsModel.SnapshotPrototype = snapshotPrototypeModel + createSnapshotOptionsModel.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.GetShareProfile(getShareProfileOptionsModel) + result, response, operationErr := vpcService.CreateSnapshot(createSnapshotOptionsModel) 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.GetShareProfile(getShareProfileOptionsModel) + result, response, operationErr = vpcService.CreateSnapshot(createSnapshotOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -55085,17 +56184,33 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetShareProfile(getShareProfileOptions *GetShareProfileOptions)`, func() { + Describe(`CreateSnapshot(createSnapshotOptions *CreateSnapshotOptions)`, func() { version := "testString" - getShareProfilePath := "/share/profiles/testString" + createSnapshotPath := "/snapshots" 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(getShareProfilePath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createSnapshotPath)) + 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))})) @@ -55104,11 +56219,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"capacity": {"type": "fixed", "value": 4800}, "family": "defined_performance", "href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "iops": {"type": "fixed", "value": 4000}, "name": "tier-3iops", "resource_type": "share_profile"}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["ServiceTags"], "size": 1, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "user_tags": ["UserTags"]}`) })) }) - It(`Invoke GetShareProfile successfully with retries`, func() { + It(`Invoke CreateSnapshot successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -55118,21 +56233,45 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetShareProfileOptions model - getShareProfileOptionsModel := new(vpcv1.GetShareProfileOptions) - getShareProfileOptionsModel.Name = core.StringPtr("testString") - getShareProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the SnapshotClonePrototype model + snapshotClonePrototypeModel := new(vpcv1.SnapshotClonePrototype) + snapshotClonePrototypeModel.Zone = zoneIdentityModel + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the VolumeIdentityByID model + volumeIdentityModel := new(vpcv1.VolumeIdentityByID) + volumeIdentityModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + + // Construct an instance of the SnapshotPrototypeSnapshotBySourceVolume model + snapshotPrototypeModel := new(vpcv1.SnapshotPrototypeSnapshotBySourceVolume) + snapshotPrototypeModel.Clones = []vpcv1.SnapshotClonePrototype{*snapshotClonePrototypeModel} + snapshotPrototypeModel.Name = core.StringPtr("my-snapshot") + snapshotPrototypeModel.ResourceGroup = resourceGroupIdentityModel + snapshotPrototypeModel.UserTags = []string{} + snapshotPrototypeModel.SourceVolume = volumeIdentityModel + + // Construct an instance of the CreateSnapshotOptions model + createSnapshotOptionsModel := new(vpcv1.CreateSnapshotOptions) + createSnapshotOptionsModel.SnapshotPrototype = snapshotPrototypeModel + createSnapshotOptionsModel.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.GetShareProfileWithContext(ctx, getShareProfileOptionsModel) + _, _, operationErr := vpcService.CreateSnapshotWithContext(ctx, createSnapshotOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetShareProfile(getShareProfileOptionsModel) + result, response, operationErr := vpcService.CreateSnapshot(createSnapshotOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -55140,7 +56279,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetShareProfileWithContext(ctx, getShareProfileOptionsModel) + _, _, operationErr = vpcService.CreateSnapshotWithContext(ctx, createSnapshotOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -55154,18 +56293,34 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getShareProfilePath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createSnapshotPath)) + 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(200) - fmt.Fprintf(res, "%s", `{"capacity": {"type": "fixed", "value": 4800}, "family": "defined_performance", "href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "iops": {"type": "fixed", "value": 4000}, "name": "tier-3iops", "resource_type": "share_profile"}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["ServiceTags"], "size": 1, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "user_tags": ["UserTags"]}`) })) }) - It(`Invoke GetShareProfile successfully`, func() { + It(`Invoke CreateSnapshot successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -55175,24 +56330,48 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetShareProfile(nil) + result, response, operationErr := vpcService.CreateSnapshot(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetShareProfileOptions model - getShareProfileOptionsModel := new(vpcv1.GetShareProfileOptions) - getShareProfileOptionsModel.Name = core.StringPtr("testString") - getShareProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the SnapshotClonePrototype model + snapshotClonePrototypeModel := new(vpcv1.SnapshotClonePrototype) + snapshotClonePrototypeModel.Zone = zoneIdentityModel + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the VolumeIdentityByID model + volumeIdentityModel := new(vpcv1.VolumeIdentityByID) + volumeIdentityModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + + // Construct an instance of the SnapshotPrototypeSnapshotBySourceVolume model + snapshotPrototypeModel := new(vpcv1.SnapshotPrototypeSnapshotBySourceVolume) + snapshotPrototypeModel.Clones = []vpcv1.SnapshotClonePrototype{*snapshotClonePrototypeModel} + snapshotPrototypeModel.Name = core.StringPtr("my-snapshot") + snapshotPrototypeModel.ResourceGroup = resourceGroupIdentityModel + snapshotPrototypeModel.UserTags = []string{} + snapshotPrototypeModel.SourceVolume = volumeIdentityModel + + // Construct an instance of the CreateSnapshotOptions model + createSnapshotOptionsModel := new(vpcv1.CreateSnapshotOptions) + createSnapshotOptionsModel.SnapshotPrototype = snapshotPrototypeModel + createSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetShareProfile(getShareProfileOptionsModel) + result, response, operationErr = vpcService.CreateSnapshot(createSnapshotOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetShareProfile with error: Operation validation and request error`, func() { + It(`Invoke CreateSnapshot with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -55201,22 +56380,46 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetShareProfileOptions model - getShareProfileOptionsModel := new(vpcv1.GetShareProfileOptions) - getShareProfileOptionsModel.Name = core.StringPtr("testString") - getShareProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the SnapshotClonePrototype model + snapshotClonePrototypeModel := new(vpcv1.SnapshotClonePrototype) + snapshotClonePrototypeModel.Zone = zoneIdentityModel + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the VolumeIdentityByID model + volumeIdentityModel := new(vpcv1.VolumeIdentityByID) + volumeIdentityModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + + // Construct an instance of the SnapshotPrototypeSnapshotBySourceVolume model + snapshotPrototypeModel := new(vpcv1.SnapshotPrototypeSnapshotBySourceVolume) + snapshotPrototypeModel.Clones = []vpcv1.SnapshotClonePrototype{*snapshotClonePrototypeModel} + snapshotPrototypeModel.Name = core.StringPtr("my-snapshot") + snapshotPrototypeModel.ResourceGroup = resourceGroupIdentityModel + snapshotPrototypeModel.UserTags = []string{} + snapshotPrototypeModel.SourceVolume = volumeIdentityModel + + // Construct an instance of the CreateSnapshotOptions model + createSnapshotOptionsModel := new(vpcv1.CreateSnapshotOptions) + createSnapshotOptionsModel.SnapshotPrototype = snapshotPrototypeModel + createSnapshotOptionsModel.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.GetShareProfile(getShareProfileOptionsModel) + result, response, operationErr := vpcService.CreateSnapshot(createSnapshotOptionsModel) 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 GetShareProfileOptions model with no property values - getShareProfileOptionsModelNew := new(vpcv1.GetShareProfileOptions) + // Construct a second instance of the CreateSnapshotOptions model with no property values + createSnapshotOptionsModelNew := new(vpcv1.CreateSnapshotOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetShareProfile(getShareProfileOptionsModelNew) + result, response, operationErr = vpcService.CreateSnapshot(createSnapshotOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -55231,10 +56434,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke GetShareProfile successfully`, func() { + It(`Invoke CreateSnapshot successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -55243,13 +56446,37 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetShareProfileOptions model - getShareProfileOptionsModel := new(vpcv1.GetShareProfileOptions) - getShareProfileOptionsModel.Name = core.StringPtr("testString") - getShareProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the SnapshotClonePrototype model + snapshotClonePrototypeModel := new(vpcv1.SnapshotClonePrototype) + snapshotClonePrototypeModel.Zone = zoneIdentityModel + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the VolumeIdentityByID model + volumeIdentityModel := new(vpcv1.VolumeIdentityByID) + volumeIdentityModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + + // Construct an instance of the SnapshotPrototypeSnapshotBySourceVolume model + snapshotPrototypeModel := new(vpcv1.SnapshotPrototypeSnapshotBySourceVolume) + snapshotPrototypeModel.Clones = []vpcv1.SnapshotClonePrototype{*snapshotClonePrototypeModel} + snapshotPrototypeModel.Name = core.StringPtr("my-snapshot") + snapshotPrototypeModel.ResourceGroup = resourceGroupIdentityModel + snapshotPrototypeModel.UserTags = []string{} + snapshotPrototypeModel.SourceVolume = volumeIdentityModel + + // Construct an instance of the CreateSnapshotOptions model + createSnapshotOptionsModel := new(vpcv1.CreateSnapshotOptions) + createSnapshotOptionsModel.SnapshotPrototype = snapshotPrototypeModel + createSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetShareProfile(getShareProfileOptionsModel) + result, response, operationErr := vpcService.CreateSnapshot(createSnapshotOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -55261,31 +56488,102 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListShares(listSharesOptions *ListSharesOptions) - Operation response error`, func() { + Describe(`DeleteSnapshot(deleteSnapshotOptions *DeleteSnapshotOptions)`, func() { version := "testString" - listSharesPath := "/shares" + deleteSnapshotPath := "/snapshots/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(deleteSnapshotPath)) + 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) + })) + }) + It(`Invoke DeleteSnapshot 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.DeleteSnapshot(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteSnapshotOptions model + deleteSnapshotOptionsModel := new(vpcv1.DeleteSnapshotOptions) + deleteSnapshotOptionsModel.ID = core.StringPtr("testString") + deleteSnapshotOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + deleteSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteSnapshot(deleteSnapshotOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteSnapshot 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 DeleteSnapshotOptions model + deleteSnapshotOptionsModel := new(vpcv1.DeleteSnapshotOptions) + deleteSnapshotOptionsModel.ID = core.StringPtr("testString") + deleteSnapshotOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + deleteSnapshotOptionsModel.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.DeleteSnapshot(deleteSnapshotOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteSnapshotOptions model with no property values + deleteSnapshotOptionsModelNew := new(vpcv1.DeleteSnapshotOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteSnapshot(deleteSnapshotOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetSnapshot(getSnapshotOptions *GetSnapshotOptions) - Operation response error`, func() { + version := "testString" + getSnapshotPath := "/snapshots/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(listSharesPath)) + Expect(req.URL.EscapedPath()).To(Equal(getSnapshotPath)) 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(10))})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) - Expect(req.URL.Query()["replication_role"]).To(Equal([]string{"none"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListShares with error: Operation response processing error`, func() { + It(`Invoke GetSnapshot with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -55294,24 +56592,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListSharesOptions model - listSharesOptionsModel := new(vpcv1.ListSharesOptions) - listSharesOptionsModel.Start = core.StringPtr("testString") - listSharesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSharesOptionsModel.ResourceGroupID = core.StringPtr("testString") - listSharesOptionsModel.Name = core.StringPtr("testString") - listSharesOptionsModel.Sort = core.StringPtr("name") - listSharesOptionsModel.ReplicationRole = core.StringPtr("none") - listSharesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSnapshotOptions model + getSnapshotOptionsModel := new(vpcv1.GetSnapshotOptions) + getSnapshotOptionsModel.ID = core.StringPtr("testString") + getSnapshotOptionsModel.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.ListShares(listSharesOptionsModel) + result, response, operationErr := vpcService.GetSnapshot(getSnapshotOptionsModel) 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.ListShares(listSharesOptionsModel) + result, response, operationErr = vpcService.GetSnapshot(getSnapshotOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -55321,36 +56614,30 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListShares(listSharesOptions *ListSharesOptions)`, func() { + Describe(`GetSnapshot(getSnapshotOptions *GetSnapshotOptions)`, func() { version := "testString" - listSharesPath := "/shares" + getSnapshotPath := "/snapshots/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(listSharesPath)) + Expect(req.URL.EscapedPath()).To(Equal(getSnapshotPath)) 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(10))})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) - Expect(req.URL.Query()["replication_role"]).To(Equal([]string{"none"})) // 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/shares?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/shares?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "shares": [{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "user_tags": ["UserTags"], "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", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["ServiceTags"], "size": 1, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "user_tags": ["UserTags"]}`) })) }) - It(`Invoke ListShares successfully with retries`, func() { + It(`Invoke GetSnapshot successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -55360,26 +56647,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListSharesOptions model - listSharesOptionsModel := new(vpcv1.ListSharesOptions) - listSharesOptionsModel.Start = core.StringPtr("testString") - listSharesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSharesOptionsModel.ResourceGroupID = core.StringPtr("testString") - listSharesOptionsModel.Name = core.StringPtr("testString") - listSharesOptionsModel.Sort = core.StringPtr("name") - listSharesOptionsModel.ReplicationRole = core.StringPtr("none") - listSharesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSnapshotOptions model + getSnapshotOptionsModel := new(vpcv1.GetSnapshotOptions) + getSnapshotOptionsModel.ID = core.StringPtr("testString") + getSnapshotOptionsModel.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.ListSharesWithContext(ctx, listSharesOptionsModel) + _, _, operationErr := vpcService.GetSnapshotWithContext(ctx, getSnapshotOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListShares(listSharesOptionsModel) + result, response, operationErr := vpcService.GetSnapshot(getSnapshotOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -55387,7 +56669,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListSharesWithContext(ctx, listSharesOptionsModel) + _, _, operationErr = vpcService.GetSnapshotWithContext(ctx, getSnapshotOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -55401,24 +56683,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listSharesPath)) + Expect(req.URL.EscapedPath()).To(Equal(getSnapshotPath)) 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(10))})) - Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) - Expect(req.URL.Query()["replication_role"]).To(Equal([]string{"none"})) // 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/shares?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/shares?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "shares": [{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "user_tags": ["UserTags"], "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", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["ServiceTags"], "size": 1, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "user_tags": ["UserTags"]}`) })) }) - It(`Invoke ListShares successfully`, func() { + It(`Invoke GetSnapshot successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -55428,29 +56704,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListShares(nil) + result, response, operationErr := vpcService.GetSnapshot(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListSharesOptions model - listSharesOptionsModel := new(vpcv1.ListSharesOptions) - listSharesOptionsModel.Start = core.StringPtr("testString") - listSharesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSharesOptionsModel.ResourceGroupID = core.StringPtr("testString") - listSharesOptionsModel.Name = core.StringPtr("testString") - listSharesOptionsModel.Sort = core.StringPtr("name") - listSharesOptionsModel.ReplicationRole = core.StringPtr("none") - listSharesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSnapshotOptions model + getSnapshotOptionsModel := new(vpcv1.GetSnapshotOptions) + getSnapshotOptionsModel.ID = core.StringPtr("testString") + getSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListShares(listSharesOptionsModel) + result, response, operationErr = vpcService.GetSnapshot(getSnapshotOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListShares with error: Operation request error`, func() { + It(`Invoke GetSnapshot with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -55459,23 +56730,25 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListSharesOptions model - listSharesOptionsModel := new(vpcv1.ListSharesOptions) - listSharesOptionsModel.Start = core.StringPtr("testString") - listSharesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSharesOptionsModel.ResourceGroupID = core.StringPtr("testString") - listSharesOptionsModel.Name = core.StringPtr("testString") - listSharesOptionsModel.Sort = core.StringPtr("name") - listSharesOptionsModel.ReplicationRole = core.StringPtr("none") - listSharesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSnapshotOptions model + getSnapshotOptionsModel := new(vpcv1.GetSnapshotOptions) + getSnapshotOptionsModel.ID = core.StringPtr("testString") + getSnapshotOptionsModel.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.ListShares(listSharesOptionsModel) + result, response, operationErr := vpcService.GetSnapshot(getSnapshotOptionsModel) 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 GetSnapshotOptions model with no property values + getSnapshotOptionsModelNew := new(vpcv1.GetSnapshotOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetSnapshot(getSnapshotOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -55490,7 +56763,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListShares successfully`, func() { + It(`Invoke GetSnapshot successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -55499,18 +56772,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListSharesOptions model - listSharesOptionsModel := new(vpcv1.ListSharesOptions) - listSharesOptionsModel.Start = core.StringPtr("testString") - listSharesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSharesOptionsModel.ResourceGroupID = core.StringPtr("testString") - listSharesOptionsModel.Name = core.StringPtr("testString") - listSharesOptionsModel.Sort = core.StringPtr("name") - listSharesOptionsModel.ReplicationRole = core.StringPtr("none") - listSharesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSnapshotOptions model + getSnapshotOptionsModel := new(vpcv1.GetSnapshotOptions) + getSnapshotOptionsModel.ID = core.StringPtr("testString") + getSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListShares(listSharesOptionsModel) + result, response, operationErr := vpcService.GetSnapshot(getSnapshotOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -55521,59 +56789,3900 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) - Context(`Test pagination helper method on response`, func() { - It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.ShareCollection) - nextObject := new(vpcv1.ShareCollectionNext) - 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.ShareCollection) - - 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.ShareCollection) - nextObject := new(vpcv1.ShareCollectionNext) - nextObject.Href = core.StringPtr("ibm.com") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - }) - Context(`Using mock server endpoint - paginated response`, func() { + }) + Describe(`UpdateSnapshot(updateSnapshotOptions *UpdateSnapshotOptions) - Operation response error`, func() { + version := "testString" + updateSnapshotPath := "/snapshots/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { - var requestNumber int = 0 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(listSharesPath)) - Expect(req.Method).To(Equal("GET")) - - // Set mock response + Expect(req.URL.EscapedPath()).To(Equal(updateSnapshotPath)) + 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 UpdateSnapshot 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 SnapshotPatch model + snapshotPatchModel := new(vpcv1.SnapshotPatch) + snapshotPatchModel.Name = core.StringPtr("my-snapshot") + snapshotPatchModel.UserTags = []string{"testString"} + snapshotPatchModelAsPatch, asPatchErr := snapshotPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateSnapshotOptions model + updateSnapshotOptionsModel := new(vpcv1.UpdateSnapshotOptions) + updateSnapshotOptionsModel.ID = core.StringPtr("testString") + updateSnapshotOptionsModel.SnapshotPatch = snapshotPatchModelAsPatch + updateSnapshotOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateSnapshotOptionsModel.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.UpdateSnapshot(updateSnapshotOptionsModel) + 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.UpdateSnapshot(updateSnapshotOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateSnapshot(updateSnapshotOptions *UpdateSnapshotOptions)`, func() { + version := "testString" + updateSnapshotPath := "/snapshots/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(updateSnapshotPath)) + 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", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["ServiceTags"], "size": 1, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "user_tags": ["UserTags"]}`) + })) + }) + It(`Invoke UpdateSnapshot 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 SnapshotPatch model + snapshotPatchModel := new(vpcv1.SnapshotPatch) + snapshotPatchModel.Name = core.StringPtr("my-snapshot") + snapshotPatchModel.UserTags = []string{"testString"} + snapshotPatchModelAsPatch, asPatchErr := snapshotPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateSnapshotOptions model + updateSnapshotOptionsModel := new(vpcv1.UpdateSnapshotOptions) + updateSnapshotOptionsModel.ID = core.StringPtr("testString") + updateSnapshotOptionsModel.SnapshotPatch = snapshotPatchModelAsPatch + updateSnapshotOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateSnapshotOptionsModel.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.UpdateSnapshotWithContext(ctx, updateSnapshotOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.UpdateSnapshot(updateSnapshotOptionsModel) + 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.UpdateSnapshotWithContext(ctx, updateSnapshotOptionsModel) + 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(updateSnapshotPath)) + 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", `{"backup_policy_plan": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/backup_policies/r134-076191ba-49c2-4763-94fd-c70de73ee2e6/plans/r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "id": "r134-6da51cfe-6f7b-4638-a6ba-00e9c327b178", "name": "my-policy-plan", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "copies": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}], "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "lifecycle_state": "stable", "minimum_capacity": 1, "name": "my-snapshot", "operating_system": {"architecture": "amd64", "dedicated_host_only": false, "display_name": "Ubuntu Server 16.04 LTS amd64", "family": "Ubuntu Server", "href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "snapshot", "service_tags": ["ServiceTags"], "size": 1, "snapshot_consistency_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot-consistency-group:r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshot_consistency_groups/r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "id": "r134-fa329f6b-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot-consistency-group", "resource_type": "snapshot_consistency_group"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image", "remote": {"account": {"id": "aa2432b1fa4d4ace891e9b80fc104e34", "resource_type": "account"}, "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "id": "r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "name": "my-snapshot", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "snapshot"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "volume"}, "user_tags": ["UserTags"]}`) + })) + }) + It(`Invoke UpdateSnapshot 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.UpdateSnapshot(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the SnapshotPatch model + snapshotPatchModel := new(vpcv1.SnapshotPatch) + snapshotPatchModel.Name = core.StringPtr("my-snapshot") + snapshotPatchModel.UserTags = []string{"testString"} + snapshotPatchModelAsPatch, asPatchErr := snapshotPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateSnapshotOptions model + updateSnapshotOptionsModel := new(vpcv1.UpdateSnapshotOptions) + updateSnapshotOptionsModel.ID = core.StringPtr("testString") + updateSnapshotOptionsModel.SnapshotPatch = snapshotPatchModelAsPatch + updateSnapshotOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdateSnapshot(updateSnapshotOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateSnapshot 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 SnapshotPatch model + snapshotPatchModel := new(vpcv1.SnapshotPatch) + snapshotPatchModel.Name = core.StringPtr("my-snapshot") + snapshotPatchModel.UserTags = []string{"testString"} + snapshotPatchModelAsPatch, asPatchErr := snapshotPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateSnapshotOptions model + updateSnapshotOptionsModel := new(vpcv1.UpdateSnapshotOptions) + updateSnapshotOptionsModel.ID = core.StringPtr("testString") + updateSnapshotOptionsModel.SnapshotPatch = snapshotPatchModelAsPatch + updateSnapshotOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateSnapshotOptionsModel.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.UpdateSnapshot(updateSnapshotOptionsModel) + 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 UpdateSnapshotOptions model with no property values + updateSnapshotOptionsModelNew := new(vpcv1.UpdateSnapshotOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateSnapshot(updateSnapshotOptionsModelNew) + 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 UpdateSnapshot 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 SnapshotPatch model + snapshotPatchModel := new(vpcv1.SnapshotPatch) + snapshotPatchModel.Name = core.StringPtr("my-snapshot") + snapshotPatchModel.UserTags = []string{"testString"} + snapshotPatchModelAsPatch, asPatchErr := snapshotPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateSnapshotOptions model + updateSnapshotOptionsModel := new(vpcv1.UpdateSnapshotOptions) + updateSnapshotOptionsModel.ID = core.StringPtr("testString") + updateSnapshotOptionsModel.SnapshotPatch = snapshotPatchModelAsPatch + updateSnapshotOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateSnapshotOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.UpdateSnapshot(updateSnapshotOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListSnapshotClones(listSnapshotClonesOptions *ListSnapshotClonesOptions) - Operation response error`, func() { + version := "testString" + listSnapshotClonesPath := "/snapshots/testString/clones" + 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(listSnapshotClonesPath)) + 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 ListSnapshotClones 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 ListSnapshotClonesOptions model + listSnapshotClonesOptionsModel := new(vpcv1.ListSnapshotClonesOptions) + listSnapshotClonesOptionsModel.ID = core.StringPtr("testString") + listSnapshotClonesOptionsModel.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.ListSnapshotClones(listSnapshotClonesOptionsModel) + 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.ListSnapshotClones(listSnapshotClonesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListSnapshotClones(listSnapshotClonesOptions *ListSnapshotClonesOptions)`, func() { + version := "testString" + listSnapshotClonesPath := "/snapshots/testString/clones" + 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(listSnapshotClonesPath)) + 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", `{"clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}]}`) + })) + }) + It(`Invoke ListSnapshotClones 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 ListSnapshotClonesOptions model + listSnapshotClonesOptionsModel := new(vpcv1.ListSnapshotClonesOptions) + listSnapshotClonesOptionsModel.ID = core.StringPtr("testString") + listSnapshotClonesOptionsModel.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.ListSnapshotClonesWithContext(ctx, listSnapshotClonesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListSnapshotClones(listSnapshotClonesOptionsModel) + 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.ListSnapshotClonesWithContext(ctx, listSnapshotClonesOptionsModel) + 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(listSnapshotClonesPath)) + 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", `{"clones": [{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}]}`) + })) + }) + It(`Invoke ListSnapshotClones 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.ListSnapshotClones(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListSnapshotClonesOptions model + listSnapshotClonesOptionsModel := new(vpcv1.ListSnapshotClonesOptions) + listSnapshotClonesOptionsModel.ID = core.StringPtr("testString") + listSnapshotClonesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListSnapshotClones(listSnapshotClonesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListSnapshotClones 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 ListSnapshotClonesOptions model + listSnapshotClonesOptionsModel := new(vpcv1.ListSnapshotClonesOptions) + listSnapshotClonesOptionsModel.ID = core.StringPtr("testString") + listSnapshotClonesOptionsModel.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.ListSnapshotClones(listSnapshotClonesOptionsModel) + 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 ListSnapshotClonesOptions model with no property values + listSnapshotClonesOptionsModelNew := new(vpcv1.ListSnapshotClonesOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListSnapshotClones(listSnapshotClonesOptionsModelNew) + 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 ListSnapshotClones 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 ListSnapshotClonesOptions model + listSnapshotClonesOptionsModel := new(vpcv1.ListSnapshotClonesOptions) + listSnapshotClonesOptionsModel.ID = core.StringPtr("testString") + listSnapshotClonesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListSnapshotClones(listSnapshotClonesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteSnapshotClone(deleteSnapshotCloneOptions *DeleteSnapshotCloneOptions)`, func() { + version := "testString" + deleteSnapshotClonePath := "/snapshots/testString/clones/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(deleteSnapshotClonePath)) + 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 DeleteSnapshotClone 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.DeleteSnapshotClone(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteSnapshotCloneOptions model + deleteSnapshotCloneOptionsModel := new(vpcv1.DeleteSnapshotCloneOptions) + deleteSnapshotCloneOptionsModel.ID = core.StringPtr("testString") + deleteSnapshotCloneOptionsModel.ZoneName = core.StringPtr("testString") + deleteSnapshotCloneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteSnapshotClone(deleteSnapshotCloneOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteSnapshotClone 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 DeleteSnapshotCloneOptions model + deleteSnapshotCloneOptionsModel := new(vpcv1.DeleteSnapshotCloneOptions) + deleteSnapshotCloneOptionsModel.ID = core.StringPtr("testString") + deleteSnapshotCloneOptionsModel.ZoneName = core.StringPtr("testString") + deleteSnapshotCloneOptionsModel.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.DeleteSnapshotClone(deleteSnapshotCloneOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteSnapshotCloneOptions model with no property values + deleteSnapshotCloneOptionsModelNew := new(vpcv1.DeleteSnapshotCloneOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteSnapshotClone(deleteSnapshotCloneOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetSnapshotClone(getSnapshotCloneOptions *GetSnapshotCloneOptions) - Operation response error`, func() { + version := "testString" + getSnapshotClonePath := "/snapshots/testString/clones/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(getSnapshotClonePath)) + 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 GetSnapshotClone 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 GetSnapshotCloneOptions model + getSnapshotCloneOptionsModel := new(vpcv1.GetSnapshotCloneOptions) + getSnapshotCloneOptionsModel.ID = core.StringPtr("testString") + getSnapshotCloneOptionsModel.ZoneName = core.StringPtr("testString") + getSnapshotCloneOptionsModel.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.GetSnapshotClone(getSnapshotCloneOptionsModel) + 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.GetSnapshotClone(getSnapshotCloneOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetSnapshotClone(getSnapshotCloneOptions *GetSnapshotCloneOptions)`, func() { + version := "testString" + getSnapshotClonePath := "/snapshots/testString/clones/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(getSnapshotClonePath)) + 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", `{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke GetSnapshotClone 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 GetSnapshotCloneOptions model + getSnapshotCloneOptionsModel := new(vpcv1.GetSnapshotCloneOptions) + getSnapshotCloneOptionsModel.ID = core.StringPtr("testString") + getSnapshotCloneOptionsModel.ZoneName = core.StringPtr("testString") + getSnapshotCloneOptionsModel.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.GetSnapshotCloneWithContext(ctx, getSnapshotCloneOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetSnapshotClone(getSnapshotCloneOptionsModel) + 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.GetSnapshotCloneWithContext(ctx, getSnapshotCloneOptionsModel) + 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(getSnapshotClonePath)) + 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", `{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke GetSnapshotClone 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.GetSnapshotClone(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetSnapshotCloneOptions model + getSnapshotCloneOptionsModel := new(vpcv1.GetSnapshotCloneOptions) + getSnapshotCloneOptionsModel.ID = core.StringPtr("testString") + getSnapshotCloneOptionsModel.ZoneName = core.StringPtr("testString") + getSnapshotCloneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetSnapshotClone(getSnapshotCloneOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetSnapshotClone 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 GetSnapshotCloneOptions model + getSnapshotCloneOptionsModel := new(vpcv1.GetSnapshotCloneOptions) + getSnapshotCloneOptionsModel.ID = core.StringPtr("testString") + getSnapshotCloneOptionsModel.ZoneName = core.StringPtr("testString") + getSnapshotCloneOptionsModel.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.GetSnapshotClone(getSnapshotCloneOptionsModel) + 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 GetSnapshotCloneOptions model with no property values + getSnapshotCloneOptionsModelNew := new(vpcv1.GetSnapshotCloneOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetSnapshotClone(getSnapshotCloneOptionsModelNew) + 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 GetSnapshotClone 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 GetSnapshotCloneOptions model + getSnapshotCloneOptionsModel := new(vpcv1.GetSnapshotCloneOptions) + getSnapshotCloneOptionsModel.ID = core.StringPtr("testString") + getSnapshotCloneOptionsModel.ZoneName = core.StringPtr("testString") + getSnapshotCloneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetSnapshotClone(getSnapshotCloneOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateSnapshotClone(createSnapshotCloneOptions *CreateSnapshotCloneOptions) - Operation response error`, func() { + version := "testString" + createSnapshotClonePath := "/snapshots/testString/clones/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(createSnapshotClonePath)) + Expect(req.Method).To(Equal("PUT")) + 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 CreateSnapshotClone 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 CreateSnapshotCloneOptions model + createSnapshotCloneOptionsModel := new(vpcv1.CreateSnapshotCloneOptions) + createSnapshotCloneOptionsModel.ID = core.StringPtr("testString") + createSnapshotCloneOptionsModel.ZoneName = core.StringPtr("testString") + createSnapshotCloneOptionsModel.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.CreateSnapshotClone(createSnapshotCloneOptionsModel) + 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.CreateSnapshotClone(createSnapshotCloneOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateSnapshotClone(createSnapshotCloneOptions *CreateSnapshotCloneOptions)`, func() { + version := "testString" + createSnapshotClonePath := "/snapshots/testString/clones/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(createSnapshotClonePath)) + Expect(req.Method).To(Equal("PUT")) + + 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", `{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke CreateSnapshotClone 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 CreateSnapshotCloneOptions model + createSnapshotCloneOptionsModel := new(vpcv1.CreateSnapshotCloneOptions) + createSnapshotCloneOptionsModel.ID = core.StringPtr("testString") + createSnapshotCloneOptionsModel.ZoneName = core.StringPtr("testString") + createSnapshotCloneOptionsModel.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.CreateSnapshotCloneWithContext(ctx, createSnapshotCloneOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateSnapshotClone(createSnapshotCloneOptionsModel) + 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.CreateSnapshotCloneWithContext(ctx, createSnapshotCloneOptionsModel) + 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(createSnapshotClonePath)) + Expect(req.Method).To(Equal("PUT")) + + 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", `{"available": false, "created_at": "2019-01-01T12:00:00.000Z", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke CreateSnapshotClone 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.CreateSnapshotClone(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the CreateSnapshotCloneOptions model + createSnapshotCloneOptionsModel := new(vpcv1.CreateSnapshotCloneOptions) + createSnapshotCloneOptionsModel.ID = core.StringPtr("testString") + createSnapshotCloneOptionsModel.ZoneName = core.StringPtr("testString") + createSnapshotCloneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateSnapshotClone(createSnapshotCloneOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateSnapshotClone 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 CreateSnapshotCloneOptions model + createSnapshotCloneOptionsModel := new(vpcv1.CreateSnapshotCloneOptions) + createSnapshotCloneOptionsModel.ID = core.StringPtr("testString") + createSnapshotCloneOptionsModel.ZoneName = core.StringPtr("testString") + createSnapshotCloneOptionsModel.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.CreateSnapshotClone(createSnapshotCloneOptionsModel) + 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 CreateSnapshotCloneOptions model with no property values + createSnapshotCloneOptionsModelNew := new(vpcv1.CreateSnapshotCloneOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateSnapshotClone(createSnapshotCloneOptionsModelNew) + 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 CreateSnapshotClone 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 CreateSnapshotCloneOptions model + createSnapshotCloneOptionsModel := new(vpcv1.CreateSnapshotCloneOptions) + createSnapshotCloneOptionsModel.ID = core.StringPtr("testString") + createSnapshotCloneOptionsModel.ZoneName = core.StringPtr("testString") + createSnapshotCloneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateSnapshotClone(createSnapshotCloneOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListShareProfiles(listShareProfilesOptions *ListShareProfilesOptions) - Operation response error`, func() { + version := "testString" + listShareProfilesPath := "/share/profiles" + 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(listShareProfilesPath)) + 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(10))})) + 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 ListShareProfiles 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 ListShareProfilesOptions model + listShareProfilesOptionsModel := new(vpcv1.ListShareProfilesOptions) + listShareProfilesOptionsModel.Start = core.StringPtr("testString") + listShareProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listShareProfilesOptionsModel.Sort = core.StringPtr("name") + listShareProfilesOptionsModel.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.ListShareProfiles(listShareProfilesOptionsModel) + 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.ListShareProfiles(listShareProfilesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListShareProfiles(listShareProfilesOptions *ListShareProfilesOptions)`, func() { + version := "testString" + listShareProfilesPath := "/share/profiles" + 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(listShareProfilesPath)) + 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(10))})) + 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/share/profiles?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "profiles": [{"capacity": {"type": "fixed", "value": 4800}, "family": "defined_performance", "href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "iops": {"type": "fixed", "value": 4000}, "name": "tier-3iops", "resource_type": "share_profile"}], "total_count": 132}`) + })) + }) + It(`Invoke ListShareProfiles 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 ListShareProfilesOptions model + listShareProfilesOptionsModel := new(vpcv1.ListShareProfilesOptions) + listShareProfilesOptionsModel.Start = core.StringPtr("testString") + listShareProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listShareProfilesOptionsModel.Sort = core.StringPtr("name") + listShareProfilesOptionsModel.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.ListShareProfilesWithContext(ctx, listShareProfilesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListShareProfiles(listShareProfilesOptionsModel) + 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.ListShareProfilesWithContext(ctx, listShareProfilesOptionsModel) + 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(listShareProfilesPath)) + 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(10))})) + 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/share/profiles?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "profiles": [{"capacity": {"type": "fixed", "value": 4800}, "family": "defined_performance", "href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "iops": {"type": "fixed", "value": 4000}, "name": "tier-3iops", "resource_type": "share_profile"}], "total_count": 132}`) + })) + }) + It(`Invoke ListShareProfiles 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.ListShareProfiles(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListShareProfilesOptions model + listShareProfilesOptionsModel := new(vpcv1.ListShareProfilesOptions) + listShareProfilesOptionsModel.Start = core.StringPtr("testString") + listShareProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listShareProfilesOptionsModel.Sort = core.StringPtr("name") + listShareProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListShareProfiles(listShareProfilesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListShareProfiles 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 ListShareProfilesOptions model + listShareProfilesOptionsModel := new(vpcv1.ListShareProfilesOptions) + listShareProfilesOptionsModel.Start = core.StringPtr("testString") + listShareProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listShareProfilesOptionsModel.Sort = core.StringPtr("name") + listShareProfilesOptionsModel.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.ListShareProfiles(listShareProfilesOptionsModel) + 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 ListShareProfiles 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 ListShareProfilesOptions model + listShareProfilesOptionsModel := new(vpcv1.ListShareProfilesOptions) + listShareProfilesOptionsModel.Start = core.StringPtr("testString") + listShareProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listShareProfilesOptionsModel.Sort = core.StringPtr("name") + listShareProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListShareProfiles(listShareProfilesOptionsModel) + 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.ShareProfileCollection) + nextObject := new(vpcv1.ShareProfileCollectionNext) + 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.ShareProfileCollection) + + 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.ShareProfileCollection) + nextObject := new(vpcv1.ShareProfileCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { + BeforeEach(func() { + var requestNumber int = 0 + 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(listShareProfilesPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"profiles":[{"capacity":{"type":"fixed","value":4800},"family":"defined_performance","href":"https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops","iops":{"type":"fixed","value":4000},"name":"tier-3iops","resource_type":"share_profile"}]}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"profiles":[{"capacity":{"type":"fixed","value":4800},"family":"defined_performance","href":"https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops","iops":{"type":"fixed","value":4000},"name":"tier-3iops","resource_type":"share_profile"}]}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use ShareProfilesPager.GetNext 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()) + + listShareProfilesOptionsModel := &vpcv1.ListShareProfilesOptions{ + Limit: core.Int64Ptr(int64(10)), + Sort: core.StringPtr("name"), + } + + pager, err := vpcService.NewShareProfilesPager(listShareProfilesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.ShareProfile + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) + }) + It(`Use ShareProfilesPager.GetAll 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()) + + listShareProfilesOptionsModel := &vpcv1.ListShareProfilesOptions{ + Limit: core.Int64Ptr(int64(10)), + Sort: core.StringPtr("name"), + } + + pager, err := vpcService.NewShareProfilesPager(listShareProfilesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) + }) + }) + }) + Describe(`GetShareProfile(getShareProfileOptions *GetShareProfileOptions) - Operation response error`, func() { + version := "testString" + getShareProfilePath := "/share/profiles/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(getShareProfilePath)) + 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 GetShareProfile 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 GetShareProfileOptions model + getShareProfileOptionsModel := new(vpcv1.GetShareProfileOptions) + getShareProfileOptionsModel.Name = core.StringPtr("testString") + getShareProfileOptionsModel.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.GetShareProfile(getShareProfileOptionsModel) + 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.GetShareProfile(getShareProfileOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetShareProfile(getShareProfileOptions *GetShareProfileOptions)`, func() { + version := "testString" + getShareProfilePath := "/share/profiles/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(getShareProfilePath)) + 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", `{"capacity": {"type": "fixed", "value": 4800}, "family": "defined_performance", "href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "iops": {"type": "fixed", "value": 4000}, "name": "tier-3iops", "resource_type": "share_profile"}`) + })) + }) + It(`Invoke GetShareProfile 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 GetShareProfileOptions model + getShareProfileOptionsModel := new(vpcv1.GetShareProfileOptions) + getShareProfileOptionsModel.Name = core.StringPtr("testString") + getShareProfileOptionsModel.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.GetShareProfileWithContext(ctx, getShareProfileOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetShareProfile(getShareProfileOptionsModel) + 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.GetShareProfileWithContext(ctx, getShareProfileOptionsModel) + 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(getShareProfilePath)) + 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", `{"capacity": {"type": "fixed", "value": 4800}, "family": "defined_performance", "href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "iops": {"type": "fixed", "value": 4000}, "name": "tier-3iops", "resource_type": "share_profile"}`) + })) + }) + It(`Invoke GetShareProfile 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.GetShareProfile(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetShareProfileOptions model + getShareProfileOptionsModel := new(vpcv1.GetShareProfileOptions) + getShareProfileOptionsModel.Name = core.StringPtr("testString") + getShareProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetShareProfile(getShareProfileOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetShareProfile 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 GetShareProfileOptions model + getShareProfileOptionsModel := new(vpcv1.GetShareProfileOptions) + getShareProfileOptionsModel.Name = core.StringPtr("testString") + getShareProfileOptionsModel.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.GetShareProfile(getShareProfileOptionsModel) + 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 GetShareProfileOptions model with no property values + getShareProfileOptionsModelNew := new(vpcv1.GetShareProfileOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetShareProfile(getShareProfileOptionsModelNew) + 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 GetShareProfile 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 GetShareProfileOptions model + getShareProfileOptionsModel := new(vpcv1.GetShareProfileOptions) + getShareProfileOptionsModel.Name = core.StringPtr("testString") + getShareProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetShareProfile(getShareProfileOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListShares(listSharesOptions *ListSharesOptions) - Operation response error`, func() { + version := "testString" + listSharesPath := "/shares" + 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(listSharesPath)) + 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(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) + Expect(req.URL.Query()["replication_role"]).To(Equal([]string{"none"})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListShares 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 ListSharesOptions model + listSharesOptionsModel := new(vpcv1.ListSharesOptions) + listSharesOptionsModel.Start = core.StringPtr("testString") + listSharesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listSharesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSharesOptionsModel.Name = core.StringPtr("testString") + listSharesOptionsModel.Sort = core.StringPtr("name") + listSharesOptionsModel.ReplicationRole = core.StringPtr("none") + listSharesOptionsModel.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.ListShares(listSharesOptionsModel) + 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.ListShares(listSharesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListShares(listSharesOptions *ListSharesOptions)`, func() { + version := "testString" + listSharesPath := "/shares" + 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(listSharesPath)) + 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(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) + Expect(req.URL.Query()["replication_role"]).To(Equal([]string{"none"})) + // 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/shares?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/shares?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "shares": [{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "user_tags": ["UserTags"], "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 ListShares 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 ListSharesOptions model + listSharesOptionsModel := new(vpcv1.ListSharesOptions) + listSharesOptionsModel.Start = core.StringPtr("testString") + listSharesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listSharesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSharesOptionsModel.Name = core.StringPtr("testString") + listSharesOptionsModel.Sort = core.StringPtr("name") + listSharesOptionsModel.ReplicationRole = core.StringPtr("none") + listSharesOptionsModel.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.ListSharesWithContext(ctx, listSharesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListShares(listSharesOptionsModel) + 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.ListSharesWithContext(ctx, listSharesOptionsModel) + 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(listSharesPath)) + 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(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) + Expect(req.URL.Query()["replication_role"]).To(Equal([]string{"none"})) + // 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/shares?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/shares?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "shares": [{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "user_tags": ["UserTags"], "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 ListShares 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.ListShares(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListSharesOptions model + listSharesOptionsModel := new(vpcv1.ListSharesOptions) + listSharesOptionsModel.Start = core.StringPtr("testString") + listSharesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listSharesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSharesOptionsModel.Name = core.StringPtr("testString") + listSharesOptionsModel.Sort = core.StringPtr("name") + listSharesOptionsModel.ReplicationRole = core.StringPtr("none") + listSharesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListShares(listSharesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListShares 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 ListSharesOptions model + listSharesOptionsModel := new(vpcv1.ListSharesOptions) + listSharesOptionsModel.Start = core.StringPtr("testString") + listSharesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listSharesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSharesOptionsModel.Name = core.StringPtr("testString") + listSharesOptionsModel.Sort = core.StringPtr("name") + listSharesOptionsModel.ReplicationRole = core.StringPtr("none") + listSharesOptionsModel.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.ListShares(listSharesOptionsModel) + 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 ListShares 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 ListSharesOptions model + listSharesOptionsModel := new(vpcv1.ListSharesOptions) + listSharesOptionsModel.Start = core.StringPtr("testString") + listSharesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listSharesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSharesOptionsModel.Name = core.StringPtr("testString") + listSharesOptionsModel.Sort = core.StringPtr("name") + listSharesOptionsModel.ReplicationRole = core.StringPtr("none") + listSharesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListShares(listSharesOptionsModel) + 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.ShareCollection) + nextObject := new(vpcv1.ShareCollectionNext) + 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.ShareCollection) + + 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.ShareCollection) + nextObject := new(vpcv1.ShareCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { + BeforeEach(func() { + var requestNumber int = 0 + 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(listSharesPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"shares":[{"access_control_mode":"security_group","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58","encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"0fe9e5d8-0a4d-4818-96ec-e99708644a58","iops":100,"latest_job":{"status":"cancelled","status_reasons":[{"code":"cannot_reach_source_share","message":"The replication failover failed because the source share cannot be reached.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}],"type":"replication_failover"},"latest_sync":{"completed_at":"2019-01-01T12:00:00.000Z","data_transferred":0,"started_at":"2019-01-01T12:00:00.000Z"},"lifecycle_state":"stable","mount_targets":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c","id":"4cf9171a-0043-4434-8727-15b53dbc374c","name":"my-share-mount-target","resource_type":"share_mount_target"}],"name":"my-share","profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops","name":"tier-3iops","resource_type":"share_profile"},"replica_share":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"replication_cron_spec":"0 */5 * * *","replication_role":"none","replication_status":"active","replication_status_reasons":[{"code":"cannot_reach_source_share","message":"The replication failover failed because the source share cannot be reached.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}],"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"share","size":200,"source_share":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"user_tags":["UserTags"],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"shares":[{"access_control_mode":"security_group","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58","encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"0fe9e5d8-0a4d-4818-96ec-e99708644a58","iops":100,"latest_job":{"status":"cancelled","status_reasons":[{"code":"cannot_reach_source_share","message":"The replication failover failed because the source share cannot be reached.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}],"type":"replication_failover"},"latest_sync":{"completed_at":"2019-01-01T12:00:00.000Z","data_transferred":0,"started_at":"2019-01-01T12:00:00.000Z"},"lifecycle_state":"stable","mount_targets":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c","id":"4cf9171a-0043-4434-8727-15b53dbc374c","name":"my-share-mount-target","resource_type":"share_mount_target"}],"name":"my-share","profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops","name":"tier-3iops","resource_type":"share_profile"},"replica_share":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"replication_cron_spec":"0 */5 * * *","replication_role":"none","replication_status":"active","replication_status_reasons":[{"code":"cannot_reach_source_share","message":"The replication failover failed because the source share cannot be reached.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}],"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"share","size":200,"source_share":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"user_tags":["UserTags"],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use SharesPager.GetNext 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()) + + listSharesOptionsModel := &vpcv1.ListSharesOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + Name: core.StringPtr("testString"), + Sort: core.StringPtr("name"), + ReplicationRole: core.StringPtr("none"), + } + + pager, err := vpcService.NewSharesPager(listSharesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.Share + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) + }) + It(`Use SharesPager.GetAll 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()) + + listSharesOptionsModel := &vpcv1.ListSharesOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + Name: core.StringPtr("testString"), + Sort: core.StringPtr("name"), + ReplicationRole: core.StringPtr("none"), + } + + pager, err := vpcService.NewSharesPager(listSharesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) + }) + }) + }) + Describe(`CreateShare(createShareOptions *CreateShareOptions) - Operation response error`, func() { + version := "testString" + createSharePath := "/shares" + 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(createSharePath)) + 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 CreateShare 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 VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // 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 SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model + shareMountTargetVirtualNetworkInterfacePrototypeModel := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) + shareMountTargetVirtualNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + shareMountTargetVirtualNetworkInterfacePrototypeModel.AutoDelete = core.BoolPtr(false) + shareMountTargetVirtualNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + shareMountTargetVirtualNetworkInterfacePrototypeModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + shareMountTargetVirtualNetworkInterfacePrototypeModel.Name = core.StringPtr("my-virtual-network-interface") + shareMountTargetVirtualNetworkInterfacePrototypeModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + shareMountTargetVirtualNetworkInterfacePrototypeModel.ResourceGroup = resourceGroupIdentityModel + shareMountTargetVirtualNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + shareMountTargetVirtualNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + + // Construct an instance of the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model + shareMountTargetPrototypeModel := new(vpcv1.ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) + shareMountTargetPrototypeModel.Name = core.StringPtr("my-share-mount-target") + shareMountTargetPrototypeModel.TransitEncryption = core.StringPtr("none") + shareMountTargetPrototypeModel.VirtualNetworkInterface = shareMountTargetVirtualNetworkInterfacePrototypeModel + + // Construct an instance of the ShareProfileIdentityByName model + shareProfileIdentityModel := new(vpcv1.ShareProfileIdentityByName) + shareProfileIdentityModel.Name = core.StringPtr("tier-3iops") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the SharePrototypeShareContext model + sharePrototypeShareContextModel := new(vpcv1.SharePrototypeShareContext) + sharePrototypeShareContextModel.Iops = core.Int64Ptr(int64(100)) + sharePrototypeShareContextModel.MountTargets = []vpcv1.ShareMountTargetPrototypeIntf{shareMountTargetPrototypeModel} + sharePrototypeShareContextModel.Name = core.StringPtr("my-share") + sharePrototypeShareContextModel.Profile = shareProfileIdentityModel + sharePrototypeShareContextModel.ReplicationCronSpec = core.StringPtr("0 */5 * * *") + sharePrototypeShareContextModel.ResourceGroup = resourceGroupIdentityModel + sharePrototypeShareContextModel.UserTags = []string{} + sharePrototypeShareContextModel.Zone = zoneIdentityModel + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the ShareInitialOwner model + shareInitialOwnerModel := new(vpcv1.ShareInitialOwner) + shareInitialOwnerModel.Gid = core.Int64Ptr(int64(50)) + shareInitialOwnerModel.Uid = core.Int64Ptr(int64(50)) + + // Construct an instance of the SharePrototypeShareBySize model + sharePrototypeModel := new(vpcv1.SharePrototypeShareBySize) + sharePrototypeModel.Iops = core.Int64Ptr(int64(100)) + sharePrototypeModel.MountTargets = []vpcv1.ShareMountTargetPrototypeIntf{shareMountTargetPrototypeModel} + sharePrototypeModel.Name = core.StringPtr("my-share") + sharePrototypeModel.Profile = shareProfileIdentityModel + sharePrototypeModel.ReplicaShare = sharePrototypeShareContextModel + sharePrototypeModel.UserTags = []string{} + sharePrototypeModel.Zone = zoneIdentityModel + sharePrototypeModel.AccessControlMode = core.StringPtr("security_group") + sharePrototypeModel.EncryptionKey = encryptionKeyIdentityModel + sharePrototypeModel.InitialOwner = shareInitialOwnerModel + sharePrototypeModel.ResourceGroup = resourceGroupIdentityModel + sharePrototypeModel.Size = core.Int64Ptr(int64(200)) + + // Construct an instance of the CreateShareOptions model + createShareOptionsModel := new(vpcv1.CreateShareOptions) + createShareOptionsModel.SharePrototype = sharePrototypeModel + createShareOptionsModel.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.CreateShare(createShareOptionsModel) + 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.CreateShare(createShareOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateShare(createShareOptions *CreateShareOptions)`, func() { + version := "testString" + createSharePath := "/shares" + 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(createSharePath)) + 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", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "user_tags": ["UserTags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke CreateShare 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 VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // 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 SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model + shareMountTargetVirtualNetworkInterfacePrototypeModel := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) + shareMountTargetVirtualNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + shareMountTargetVirtualNetworkInterfacePrototypeModel.AutoDelete = core.BoolPtr(false) + shareMountTargetVirtualNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + shareMountTargetVirtualNetworkInterfacePrototypeModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + shareMountTargetVirtualNetworkInterfacePrototypeModel.Name = core.StringPtr("my-virtual-network-interface") + shareMountTargetVirtualNetworkInterfacePrototypeModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + shareMountTargetVirtualNetworkInterfacePrototypeModel.ResourceGroup = resourceGroupIdentityModel + shareMountTargetVirtualNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + shareMountTargetVirtualNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + + // Construct an instance of the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model + shareMountTargetPrototypeModel := new(vpcv1.ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) + shareMountTargetPrototypeModel.Name = core.StringPtr("my-share-mount-target") + shareMountTargetPrototypeModel.TransitEncryption = core.StringPtr("none") + shareMountTargetPrototypeModel.VirtualNetworkInterface = shareMountTargetVirtualNetworkInterfacePrototypeModel + + // Construct an instance of the ShareProfileIdentityByName model + shareProfileIdentityModel := new(vpcv1.ShareProfileIdentityByName) + shareProfileIdentityModel.Name = core.StringPtr("tier-3iops") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the SharePrototypeShareContext model + sharePrototypeShareContextModel := new(vpcv1.SharePrototypeShareContext) + sharePrototypeShareContextModel.Iops = core.Int64Ptr(int64(100)) + sharePrototypeShareContextModel.MountTargets = []vpcv1.ShareMountTargetPrototypeIntf{shareMountTargetPrototypeModel} + sharePrototypeShareContextModel.Name = core.StringPtr("my-share") + sharePrototypeShareContextModel.Profile = shareProfileIdentityModel + sharePrototypeShareContextModel.ReplicationCronSpec = core.StringPtr("0 */5 * * *") + sharePrototypeShareContextModel.ResourceGroup = resourceGroupIdentityModel + sharePrototypeShareContextModel.UserTags = []string{} + sharePrototypeShareContextModel.Zone = zoneIdentityModel + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the ShareInitialOwner model + shareInitialOwnerModel := new(vpcv1.ShareInitialOwner) + shareInitialOwnerModel.Gid = core.Int64Ptr(int64(50)) + shareInitialOwnerModel.Uid = core.Int64Ptr(int64(50)) + + // Construct an instance of the SharePrototypeShareBySize model + sharePrototypeModel := new(vpcv1.SharePrototypeShareBySize) + sharePrototypeModel.Iops = core.Int64Ptr(int64(100)) + sharePrototypeModel.MountTargets = []vpcv1.ShareMountTargetPrototypeIntf{shareMountTargetPrototypeModel} + sharePrototypeModel.Name = core.StringPtr("my-share") + sharePrototypeModel.Profile = shareProfileIdentityModel + sharePrototypeModel.ReplicaShare = sharePrototypeShareContextModel + sharePrototypeModel.UserTags = []string{} + sharePrototypeModel.Zone = zoneIdentityModel + sharePrototypeModel.AccessControlMode = core.StringPtr("security_group") + sharePrototypeModel.EncryptionKey = encryptionKeyIdentityModel + sharePrototypeModel.InitialOwner = shareInitialOwnerModel + sharePrototypeModel.ResourceGroup = resourceGroupIdentityModel + sharePrototypeModel.Size = core.Int64Ptr(int64(200)) + + // Construct an instance of the CreateShareOptions model + createShareOptionsModel := new(vpcv1.CreateShareOptions) + createShareOptionsModel.SharePrototype = sharePrototypeModel + createShareOptionsModel.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.CreateShareWithContext(ctx, createShareOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateShare(createShareOptionsModel) + 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.CreateShareWithContext(ctx, createShareOptionsModel) + 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(createSharePath)) + 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", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "user_tags": ["UserTags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke CreateShare 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.CreateShare(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // 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 SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model + shareMountTargetVirtualNetworkInterfacePrototypeModel := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) + shareMountTargetVirtualNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + shareMountTargetVirtualNetworkInterfacePrototypeModel.AutoDelete = core.BoolPtr(false) + shareMountTargetVirtualNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + shareMountTargetVirtualNetworkInterfacePrototypeModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + shareMountTargetVirtualNetworkInterfacePrototypeModel.Name = core.StringPtr("my-virtual-network-interface") + shareMountTargetVirtualNetworkInterfacePrototypeModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + shareMountTargetVirtualNetworkInterfacePrototypeModel.ResourceGroup = resourceGroupIdentityModel + shareMountTargetVirtualNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + shareMountTargetVirtualNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + + // Construct an instance of the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model + shareMountTargetPrototypeModel := new(vpcv1.ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) + shareMountTargetPrototypeModel.Name = core.StringPtr("my-share-mount-target") + shareMountTargetPrototypeModel.TransitEncryption = core.StringPtr("none") + shareMountTargetPrototypeModel.VirtualNetworkInterface = shareMountTargetVirtualNetworkInterfacePrototypeModel + + // Construct an instance of the ShareProfileIdentityByName model + shareProfileIdentityModel := new(vpcv1.ShareProfileIdentityByName) + shareProfileIdentityModel.Name = core.StringPtr("tier-3iops") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the SharePrototypeShareContext model + sharePrototypeShareContextModel := new(vpcv1.SharePrototypeShareContext) + sharePrototypeShareContextModel.Iops = core.Int64Ptr(int64(100)) + sharePrototypeShareContextModel.MountTargets = []vpcv1.ShareMountTargetPrototypeIntf{shareMountTargetPrototypeModel} + sharePrototypeShareContextModel.Name = core.StringPtr("my-share") + sharePrototypeShareContextModel.Profile = shareProfileIdentityModel + sharePrototypeShareContextModel.ReplicationCronSpec = core.StringPtr("0 */5 * * *") + sharePrototypeShareContextModel.ResourceGroup = resourceGroupIdentityModel + sharePrototypeShareContextModel.UserTags = []string{} + sharePrototypeShareContextModel.Zone = zoneIdentityModel + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the ShareInitialOwner model + shareInitialOwnerModel := new(vpcv1.ShareInitialOwner) + shareInitialOwnerModel.Gid = core.Int64Ptr(int64(50)) + shareInitialOwnerModel.Uid = core.Int64Ptr(int64(50)) + + // Construct an instance of the SharePrototypeShareBySize model + sharePrototypeModel := new(vpcv1.SharePrototypeShareBySize) + sharePrototypeModel.Iops = core.Int64Ptr(int64(100)) + sharePrototypeModel.MountTargets = []vpcv1.ShareMountTargetPrototypeIntf{shareMountTargetPrototypeModel} + sharePrototypeModel.Name = core.StringPtr("my-share") + sharePrototypeModel.Profile = shareProfileIdentityModel + sharePrototypeModel.ReplicaShare = sharePrototypeShareContextModel + sharePrototypeModel.UserTags = []string{} + sharePrototypeModel.Zone = zoneIdentityModel + sharePrototypeModel.AccessControlMode = core.StringPtr("security_group") + sharePrototypeModel.EncryptionKey = encryptionKeyIdentityModel + sharePrototypeModel.InitialOwner = shareInitialOwnerModel + sharePrototypeModel.ResourceGroup = resourceGroupIdentityModel + sharePrototypeModel.Size = core.Int64Ptr(int64(200)) + + // Construct an instance of the CreateShareOptions model + createShareOptionsModel := new(vpcv1.CreateShareOptions) + createShareOptionsModel.SharePrototype = sharePrototypeModel + createShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateShare(createShareOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateShare 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 VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // 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 SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model + shareMountTargetVirtualNetworkInterfacePrototypeModel := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) + shareMountTargetVirtualNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + shareMountTargetVirtualNetworkInterfacePrototypeModel.AutoDelete = core.BoolPtr(false) + shareMountTargetVirtualNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + shareMountTargetVirtualNetworkInterfacePrototypeModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + shareMountTargetVirtualNetworkInterfacePrototypeModel.Name = core.StringPtr("my-virtual-network-interface") + shareMountTargetVirtualNetworkInterfacePrototypeModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + shareMountTargetVirtualNetworkInterfacePrototypeModel.ResourceGroup = resourceGroupIdentityModel + shareMountTargetVirtualNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + shareMountTargetVirtualNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + + // Construct an instance of the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model + shareMountTargetPrototypeModel := new(vpcv1.ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) + shareMountTargetPrototypeModel.Name = core.StringPtr("my-share-mount-target") + shareMountTargetPrototypeModel.TransitEncryption = core.StringPtr("none") + shareMountTargetPrototypeModel.VirtualNetworkInterface = shareMountTargetVirtualNetworkInterfacePrototypeModel + + // Construct an instance of the ShareProfileIdentityByName model + shareProfileIdentityModel := new(vpcv1.ShareProfileIdentityByName) + shareProfileIdentityModel.Name = core.StringPtr("tier-3iops") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the SharePrototypeShareContext model + sharePrototypeShareContextModel := new(vpcv1.SharePrototypeShareContext) + sharePrototypeShareContextModel.Iops = core.Int64Ptr(int64(100)) + sharePrototypeShareContextModel.MountTargets = []vpcv1.ShareMountTargetPrototypeIntf{shareMountTargetPrototypeModel} + sharePrototypeShareContextModel.Name = core.StringPtr("my-share") + sharePrototypeShareContextModel.Profile = shareProfileIdentityModel + sharePrototypeShareContextModel.ReplicationCronSpec = core.StringPtr("0 */5 * * *") + sharePrototypeShareContextModel.ResourceGroup = resourceGroupIdentityModel + sharePrototypeShareContextModel.UserTags = []string{} + sharePrototypeShareContextModel.Zone = zoneIdentityModel + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the ShareInitialOwner model + shareInitialOwnerModel := new(vpcv1.ShareInitialOwner) + shareInitialOwnerModel.Gid = core.Int64Ptr(int64(50)) + shareInitialOwnerModel.Uid = core.Int64Ptr(int64(50)) + + // Construct an instance of the SharePrototypeShareBySize model + sharePrototypeModel := new(vpcv1.SharePrototypeShareBySize) + sharePrototypeModel.Iops = core.Int64Ptr(int64(100)) + sharePrototypeModel.MountTargets = []vpcv1.ShareMountTargetPrototypeIntf{shareMountTargetPrototypeModel} + sharePrototypeModel.Name = core.StringPtr("my-share") + sharePrototypeModel.Profile = shareProfileIdentityModel + sharePrototypeModel.ReplicaShare = sharePrototypeShareContextModel + sharePrototypeModel.UserTags = []string{} + sharePrototypeModel.Zone = zoneIdentityModel + sharePrototypeModel.AccessControlMode = core.StringPtr("security_group") + sharePrototypeModel.EncryptionKey = encryptionKeyIdentityModel + sharePrototypeModel.InitialOwner = shareInitialOwnerModel + sharePrototypeModel.ResourceGroup = resourceGroupIdentityModel + sharePrototypeModel.Size = core.Int64Ptr(int64(200)) + + // Construct an instance of the CreateShareOptions model + createShareOptionsModel := new(vpcv1.CreateShareOptions) + createShareOptionsModel.SharePrototype = sharePrototypeModel + createShareOptionsModel.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.CreateShare(createShareOptionsModel) + 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 CreateShareOptions model with no property values + createShareOptionsModelNew := new(vpcv1.CreateShareOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateShare(createShareOptionsModelNew) + 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 CreateShare 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 VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // 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 SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model + shareMountTargetVirtualNetworkInterfacePrototypeModel := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) + shareMountTargetVirtualNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + shareMountTargetVirtualNetworkInterfacePrototypeModel.AutoDelete = core.BoolPtr(false) + shareMountTargetVirtualNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + shareMountTargetVirtualNetworkInterfacePrototypeModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + shareMountTargetVirtualNetworkInterfacePrototypeModel.Name = core.StringPtr("my-virtual-network-interface") + shareMountTargetVirtualNetworkInterfacePrototypeModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + shareMountTargetVirtualNetworkInterfacePrototypeModel.ResourceGroup = resourceGroupIdentityModel + shareMountTargetVirtualNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + shareMountTargetVirtualNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + + // Construct an instance of the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model + shareMountTargetPrototypeModel := new(vpcv1.ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) + shareMountTargetPrototypeModel.Name = core.StringPtr("my-share-mount-target") + shareMountTargetPrototypeModel.TransitEncryption = core.StringPtr("none") + shareMountTargetPrototypeModel.VirtualNetworkInterface = shareMountTargetVirtualNetworkInterfacePrototypeModel + + // Construct an instance of the ShareProfileIdentityByName model + shareProfileIdentityModel := new(vpcv1.ShareProfileIdentityByName) + shareProfileIdentityModel.Name = core.StringPtr("tier-3iops") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the SharePrototypeShareContext model + sharePrototypeShareContextModel := new(vpcv1.SharePrototypeShareContext) + sharePrototypeShareContextModel.Iops = core.Int64Ptr(int64(100)) + sharePrototypeShareContextModel.MountTargets = []vpcv1.ShareMountTargetPrototypeIntf{shareMountTargetPrototypeModel} + sharePrototypeShareContextModel.Name = core.StringPtr("my-share") + sharePrototypeShareContextModel.Profile = shareProfileIdentityModel + sharePrototypeShareContextModel.ReplicationCronSpec = core.StringPtr("0 */5 * * *") + sharePrototypeShareContextModel.ResourceGroup = resourceGroupIdentityModel + sharePrototypeShareContextModel.UserTags = []string{} + sharePrototypeShareContextModel.Zone = zoneIdentityModel + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the ShareInitialOwner model + shareInitialOwnerModel := new(vpcv1.ShareInitialOwner) + shareInitialOwnerModel.Gid = core.Int64Ptr(int64(50)) + shareInitialOwnerModel.Uid = core.Int64Ptr(int64(50)) + + // Construct an instance of the SharePrototypeShareBySize model + sharePrototypeModel := new(vpcv1.SharePrototypeShareBySize) + sharePrototypeModel.Iops = core.Int64Ptr(int64(100)) + sharePrototypeModel.MountTargets = []vpcv1.ShareMountTargetPrototypeIntf{shareMountTargetPrototypeModel} + sharePrototypeModel.Name = core.StringPtr("my-share") + sharePrototypeModel.Profile = shareProfileIdentityModel + sharePrototypeModel.ReplicaShare = sharePrototypeShareContextModel + sharePrototypeModel.UserTags = []string{} + sharePrototypeModel.Zone = zoneIdentityModel + sharePrototypeModel.AccessControlMode = core.StringPtr("security_group") + sharePrototypeModel.EncryptionKey = encryptionKeyIdentityModel + sharePrototypeModel.InitialOwner = shareInitialOwnerModel + sharePrototypeModel.ResourceGroup = resourceGroupIdentityModel + sharePrototypeModel.Size = core.Int64Ptr(int64(200)) + + // Construct an instance of the CreateShareOptions model + createShareOptionsModel := new(vpcv1.CreateShareOptions) + createShareOptionsModel.SharePrototype = sharePrototypeModel + createShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateShare(createShareOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteShare(deleteShareOptions *DeleteShareOptions) - Operation response error`, func() { + version := "testString" + deleteSharePath := "/shares/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(deleteSharePath)) + 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.Header().Set("Content-type", "application/json") + res.WriteHeader(202) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke DeleteShare 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 DeleteShareOptions model + deleteShareOptionsModel := new(vpcv1.DeleteShareOptions) + deleteShareOptionsModel.ID = core.StringPtr("testString") + deleteShareOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + deleteShareOptionsModel.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.DeleteShare(deleteShareOptionsModel) + 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.DeleteShare(deleteShareOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteShare(deleteShareOptions *DeleteShareOptions)`, func() { + version := "testString" + deleteSharePath := "/shares/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(deleteSharePath)) + 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))})) + // 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(202) + fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "user_tags": ["UserTags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke DeleteShare 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 DeleteShareOptions model + deleteShareOptionsModel := new(vpcv1.DeleteShareOptions) + deleteShareOptionsModel.ID = core.StringPtr("testString") + deleteShareOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + deleteShareOptionsModel.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.DeleteShareWithContext(ctx, deleteShareOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.DeleteShare(deleteShareOptionsModel) + 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.DeleteShareWithContext(ctx, deleteShareOptionsModel) + 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(deleteSharePath)) + 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))})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(202) + fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "user_tags": ["UserTags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke DeleteShare 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.DeleteShare(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the DeleteShareOptions model + deleteShareOptionsModel := new(vpcv1.DeleteShareOptions) + deleteShareOptionsModel.ID = core.StringPtr("testString") + deleteShareOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + deleteShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.DeleteShare(deleteShareOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke DeleteShare 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 DeleteShareOptions model + deleteShareOptionsModel := new(vpcv1.DeleteShareOptions) + deleteShareOptionsModel.ID = core.StringPtr("testString") + deleteShareOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + deleteShareOptionsModel.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.DeleteShare(deleteShareOptionsModel) + 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 DeleteShareOptions model with no property values + deleteShareOptionsModelNew := new(vpcv1.DeleteShareOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.DeleteShare(deleteShareOptionsModelNew) + 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(202) + })) + }) + It(`Invoke DeleteShare 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 DeleteShareOptions model + deleteShareOptionsModel := new(vpcv1.DeleteShareOptions) + deleteShareOptionsModel.ID = core.StringPtr("testString") + deleteShareOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + deleteShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.DeleteShare(deleteShareOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetShare(getShareOptions *GetShareOptions) - Operation response error`, func() { + version := "testString" + getSharePath := "/shares/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(getSharePath)) + 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 GetShare 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 GetShareOptions model + getShareOptionsModel := new(vpcv1.GetShareOptions) + getShareOptionsModel.ID = core.StringPtr("testString") + getShareOptionsModel.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.GetShare(getShareOptionsModel) + 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.GetShare(getShareOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetShare(getShareOptions *GetShareOptions)`, func() { + version := "testString" + getSharePath := "/shares/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(getSharePath)) + 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", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "user_tags": ["UserTags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke GetShare 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 GetShareOptions model + getShareOptionsModel := new(vpcv1.GetShareOptions) + getShareOptionsModel.ID = core.StringPtr("testString") + getShareOptionsModel.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.GetShareWithContext(ctx, getShareOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetShare(getShareOptionsModel) + 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.GetShareWithContext(ctx, getShareOptionsModel) + 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(getSharePath)) + 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", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "user_tags": ["UserTags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke GetShare 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.GetShare(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetShareOptions model + getShareOptionsModel := new(vpcv1.GetShareOptions) + getShareOptionsModel.ID = core.StringPtr("testString") + getShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetShare(getShareOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetShare 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 GetShareOptions model + getShareOptionsModel := new(vpcv1.GetShareOptions) + getShareOptionsModel.ID = core.StringPtr("testString") + getShareOptionsModel.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.GetShare(getShareOptionsModel) + 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 GetShareOptions model with no property values + getShareOptionsModelNew := new(vpcv1.GetShareOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetShare(getShareOptionsModelNew) + 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 GetShare 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 GetShareOptions model + getShareOptionsModel := new(vpcv1.GetShareOptions) + getShareOptionsModel.ID = core.StringPtr("testString") + getShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetShare(getShareOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateShare(updateShareOptions *UpdateShareOptions) - Operation response error`, func() { + version := "testString" + updateSharePath := "/shares/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(updateSharePath)) + 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 UpdateShare 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 ShareProfileIdentityByName model + shareProfileIdentityModel := new(vpcv1.ShareProfileIdentityByName) + shareProfileIdentityModel.Name = core.StringPtr("tier-3iops") + + // Construct an instance of the SharePatch model + sharePatchModel := new(vpcv1.SharePatch) + sharePatchModel.AccessControlMode = core.StringPtr("security_group") + sharePatchModel.Iops = core.Int64Ptr(int64(100)) + sharePatchModel.Name = core.StringPtr("my-share") + sharePatchModel.Profile = shareProfileIdentityModel + sharePatchModel.ReplicationCronSpec = core.StringPtr("0 */5 * * *") + sharePatchModel.Size = core.Int64Ptr(int64(200)) + sharePatchModel.UserTags = []string{"testString"} + sharePatchModelAsPatch, asPatchErr := sharePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateShareOptions model + updateShareOptionsModel := new(vpcv1.UpdateShareOptions) + updateShareOptionsModel.ID = core.StringPtr("testString") + updateShareOptionsModel.SharePatch = sharePatchModelAsPatch + updateShareOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateShareOptionsModel.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.UpdateShare(updateShareOptionsModel) + 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.UpdateShare(updateShareOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateShare(updateShareOptions *UpdateShareOptions)`, func() { + version := "testString" + updateSharePath := "/shares/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(updateSharePath)) + 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", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "user_tags": ["UserTags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke UpdateShare 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 ShareProfileIdentityByName model + shareProfileIdentityModel := new(vpcv1.ShareProfileIdentityByName) + shareProfileIdentityModel.Name = core.StringPtr("tier-3iops") + + // Construct an instance of the SharePatch model + sharePatchModel := new(vpcv1.SharePatch) + sharePatchModel.AccessControlMode = core.StringPtr("security_group") + sharePatchModel.Iops = core.Int64Ptr(int64(100)) + sharePatchModel.Name = core.StringPtr("my-share") + sharePatchModel.Profile = shareProfileIdentityModel + sharePatchModel.ReplicationCronSpec = core.StringPtr("0 */5 * * *") + sharePatchModel.Size = core.Int64Ptr(int64(200)) + sharePatchModel.UserTags = []string{"testString"} + sharePatchModelAsPatch, asPatchErr := sharePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateShareOptions model + updateShareOptionsModel := new(vpcv1.UpdateShareOptions) + updateShareOptionsModel.ID = core.StringPtr("testString") + updateShareOptionsModel.SharePatch = sharePatchModelAsPatch + updateShareOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateShareOptionsModel.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.UpdateShareWithContext(ctx, updateShareOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.UpdateShare(updateShareOptionsModel) + 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.UpdateShareWithContext(ctx, updateShareOptionsModel) + 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(updateSharePath)) + 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", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "user_tags": ["UserTags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke UpdateShare 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.UpdateShare(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ShareProfileIdentityByName model + shareProfileIdentityModel := new(vpcv1.ShareProfileIdentityByName) + shareProfileIdentityModel.Name = core.StringPtr("tier-3iops") + + // Construct an instance of the SharePatch model + sharePatchModel := new(vpcv1.SharePatch) + sharePatchModel.AccessControlMode = core.StringPtr("security_group") + sharePatchModel.Iops = core.Int64Ptr(int64(100)) + sharePatchModel.Name = core.StringPtr("my-share") + sharePatchModel.Profile = shareProfileIdentityModel + sharePatchModel.ReplicationCronSpec = core.StringPtr("0 */5 * * *") + sharePatchModel.Size = core.Int64Ptr(int64(200)) + sharePatchModel.UserTags = []string{"testString"} + sharePatchModelAsPatch, asPatchErr := sharePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateShareOptions model + updateShareOptionsModel := new(vpcv1.UpdateShareOptions) + updateShareOptionsModel.ID = core.StringPtr("testString") + updateShareOptionsModel.SharePatch = sharePatchModelAsPatch + updateShareOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdateShare(updateShareOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateShare 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 ShareProfileIdentityByName model + shareProfileIdentityModel := new(vpcv1.ShareProfileIdentityByName) + shareProfileIdentityModel.Name = core.StringPtr("tier-3iops") + + // Construct an instance of the SharePatch model + sharePatchModel := new(vpcv1.SharePatch) + sharePatchModel.AccessControlMode = core.StringPtr("security_group") + sharePatchModel.Iops = core.Int64Ptr(int64(100)) + sharePatchModel.Name = core.StringPtr("my-share") + sharePatchModel.Profile = shareProfileIdentityModel + sharePatchModel.ReplicationCronSpec = core.StringPtr("0 */5 * * *") + sharePatchModel.Size = core.Int64Ptr(int64(200)) + sharePatchModel.UserTags = []string{"testString"} + sharePatchModelAsPatch, asPatchErr := sharePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateShareOptions model + updateShareOptionsModel := new(vpcv1.UpdateShareOptions) + updateShareOptionsModel.ID = core.StringPtr("testString") + updateShareOptionsModel.SharePatch = sharePatchModelAsPatch + updateShareOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateShareOptionsModel.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.UpdateShare(updateShareOptionsModel) + 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 UpdateShareOptions model with no property values + updateShareOptionsModelNew := new(vpcv1.UpdateShareOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateShare(updateShareOptionsModelNew) + 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 UpdateShare 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 ShareProfileIdentityByName model + shareProfileIdentityModel := new(vpcv1.ShareProfileIdentityByName) + shareProfileIdentityModel.Name = core.StringPtr("tier-3iops") + + // Construct an instance of the SharePatch model + sharePatchModel := new(vpcv1.SharePatch) + sharePatchModel.AccessControlMode = core.StringPtr("security_group") + sharePatchModel.Iops = core.Int64Ptr(int64(100)) + sharePatchModel.Name = core.StringPtr("my-share") + sharePatchModel.Profile = shareProfileIdentityModel + sharePatchModel.ReplicationCronSpec = core.StringPtr("0 */5 * * *") + sharePatchModel.Size = core.Int64Ptr(int64(200)) + sharePatchModel.UserTags = []string{"testString"} + sharePatchModelAsPatch, asPatchErr := sharePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateShareOptions model + updateShareOptionsModel := new(vpcv1.UpdateShareOptions) + updateShareOptionsModel.ID = core.StringPtr("testString") + updateShareOptionsModel.SharePatch = sharePatchModelAsPatch + updateShareOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.UpdateShare(updateShareOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`FailoverShare(failoverShareOptions *FailoverShareOptions)`, func() { + version := "testString" + failoverSharePath := "/shares/testString/failover" + 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(failoverSharePath)) + 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))})) + res.WriteHeader(202) + })) + }) + It(`Invoke FailoverShare 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.FailoverShare(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the FailoverShareOptions model + failoverShareOptionsModel := new(vpcv1.FailoverShareOptions) + failoverShareOptionsModel.ShareID = core.StringPtr("testString") + failoverShareOptionsModel.FallbackPolicy = core.StringPtr("fail") + failoverShareOptionsModel.Timeout = core.Int64Ptr(int64(600)) + failoverShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.FailoverShare(failoverShareOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke FailoverShare 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 FailoverShareOptions model + failoverShareOptionsModel := new(vpcv1.FailoverShareOptions) + failoverShareOptionsModel.ShareID = core.StringPtr("testString") + failoverShareOptionsModel.FallbackPolicy = core.StringPtr("fail") + failoverShareOptionsModel.Timeout = core.Int64Ptr(int64(600)) + failoverShareOptionsModel.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.FailoverShare(failoverShareOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the FailoverShareOptions model with no property values + failoverShareOptionsModelNew := new(vpcv1.FailoverShareOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.FailoverShare(failoverShareOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListShareMountTargets(listShareMountTargetsOptions *ListShareMountTargetsOptions) - Operation response error`, func() { + version := "testString" + listShareMountTargetsPath := "/shares/testString/mount_targets" + 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(listShareMountTargetsPath)) + 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(10))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListShareMountTargets 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 ListShareMountTargetsOptions model + listShareMountTargetsOptionsModel := new(vpcv1.ListShareMountTargetsOptions) + listShareMountTargetsOptionsModel.ShareID = core.StringPtr("testString") + listShareMountTargetsOptionsModel.Name = core.StringPtr("testString") + listShareMountTargetsOptionsModel.Start = core.StringPtr("testString") + listShareMountTargetsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listShareMountTargetsOptionsModel.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.ListShareMountTargets(listShareMountTargetsOptionsModel) + 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.ListShareMountTargets(listShareMountTargetsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListShareMountTargets(listShareMountTargetsOptions *ListShareMountTargetsOptions)`, func() { + version := "testString" + listShareMountTargetsPath := "/shares/testString/mount_targets" + 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(listShareMountTargetsPath)) + 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(10))})) + // 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/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets?limit=20"}, "limit": 20, "mount_targets": [{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "primary_ip": {"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"}, "resource_type": "share_mount_target", "subnet": {"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"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "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"}}], "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + })) + }) + It(`Invoke ListShareMountTargets 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 ListShareMountTargetsOptions model + listShareMountTargetsOptionsModel := new(vpcv1.ListShareMountTargetsOptions) + listShareMountTargetsOptionsModel.ShareID = core.StringPtr("testString") + listShareMountTargetsOptionsModel.Name = core.StringPtr("testString") + listShareMountTargetsOptionsModel.Start = core.StringPtr("testString") + listShareMountTargetsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listShareMountTargetsOptionsModel.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.ListShareMountTargetsWithContext(ctx, listShareMountTargetsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListShareMountTargets(listShareMountTargetsOptionsModel) + 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.ListShareMountTargetsWithContext(ctx, listShareMountTargetsOptionsModel) + 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(listShareMountTargetsPath)) + 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(10))})) + // 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/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets?limit=20"}, "limit": 20, "mount_targets": [{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "primary_ip": {"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"}, "resource_type": "share_mount_target", "subnet": {"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"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "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"}}], "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + })) + }) + It(`Invoke ListShareMountTargets 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.ListShareMountTargets(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListShareMountTargetsOptions model + listShareMountTargetsOptionsModel := new(vpcv1.ListShareMountTargetsOptions) + listShareMountTargetsOptionsModel.ShareID = core.StringPtr("testString") + listShareMountTargetsOptionsModel.Name = core.StringPtr("testString") + listShareMountTargetsOptionsModel.Start = core.StringPtr("testString") + listShareMountTargetsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listShareMountTargetsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListShareMountTargets(listShareMountTargetsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListShareMountTargets 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 ListShareMountTargetsOptions model + listShareMountTargetsOptionsModel := new(vpcv1.ListShareMountTargetsOptions) + listShareMountTargetsOptionsModel.ShareID = core.StringPtr("testString") + listShareMountTargetsOptionsModel.Name = core.StringPtr("testString") + listShareMountTargetsOptionsModel.Start = core.StringPtr("testString") + listShareMountTargetsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listShareMountTargetsOptionsModel.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.ListShareMountTargets(listShareMountTargetsOptionsModel) + 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 ListShareMountTargetsOptions model with no property values + listShareMountTargetsOptionsModelNew := new(vpcv1.ListShareMountTargetsOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListShareMountTargets(listShareMountTargetsOptionsModelNew) + 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 ListShareMountTargets 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 ListShareMountTargetsOptions model + listShareMountTargetsOptionsModel := new(vpcv1.ListShareMountTargetsOptions) + listShareMountTargetsOptionsModel.ShareID = core.StringPtr("testString") + listShareMountTargetsOptionsModel.Name = core.StringPtr("testString") + listShareMountTargetsOptionsModel.Start = core.StringPtr("testString") + listShareMountTargetsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listShareMountTargetsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListShareMountTargets(listShareMountTargetsOptionsModel) + 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.ShareMountTargetCollection) + nextObject := new(vpcv1.ShareMountTargetCollectionNext) + 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.ShareMountTargetCollection) + + 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.ShareMountTargetCollection) + nextObject := new(vpcv1.ShareMountTargetCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { + BeforeEach(func() { + var requestNumber int = 0 + 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(listShareMountTargetsPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) requestNumber++ if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"shares":[{"access_control_mode":"security_group","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58","encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"0fe9e5d8-0a4d-4818-96ec-e99708644a58","iops":100,"latest_job":{"status":"cancelled","status_reasons":[{"code":"cannot_reach_source_share","message":"The replication failover failed because the source share cannot be reached.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}],"type":"replication_failover"},"latest_sync":{"completed_at":"2019-01-01T12:00:00.000Z","data_transferred":0,"started_at":"2019-01-01T12:00:00.000Z"},"lifecycle_state":"stable","mount_targets":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c","id":"4cf9171a-0043-4434-8727-15b53dbc374c","name":"my-share-mount-target","resource_type":"share_mount_target"}],"name":"my-share","profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops","name":"tier-3iops","resource_type":"share_profile"},"replica_share":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"replication_cron_spec":"0 */5 * * *","replication_role":"none","replication_status":"active","replication_status_reasons":[{"code":"cannot_reach_source_share","message":"The replication failover failed because the source share cannot be reached.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}],"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"share","size":200,"source_share":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"user_tags":["UserTags"],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1}`) + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"mount_targets":[{"access_control_mode":"security_group","created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c","id":"4cf9171a-0043-4434-8727-15b53dbc374c","lifecycle_state":"stable","mount_path":"10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e","name":"my-share-mount-target","primary_ip":{"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"},"resource_type":"share_mount_target","subnet":{"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"},"transit_encryption":"none","virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","id":"0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"},"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"}}]}`) } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"shares":[{"access_control_mode":"security_group","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58","encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"0fe9e5d8-0a4d-4818-96ec-e99708644a58","iops":100,"latest_job":{"status":"cancelled","status_reasons":[{"code":"cannot_reach_source_share","message":"The replication failover failed because the source share cannot be reached.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}],"type":"replication_failover"},"latest_sync":{"completed_at":"2019-01-01T12:00:00.000Z","data_transferred":0,"started_at":"2019-01-01T12:00:00.000Z"},"lifecycle_state":"stable","mount_targets":[{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c","id":"4cf9171a-0043-4434-8727-15b53dbc374c","name":"my-share-mount-target","resource_type":"share_mount_target"}],"name":"my-share","profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops","name":"tier-3iops","resource_type":"share_profile"},"replica_share":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"replication_cron_spec":"0 */5 * * *","replication_role":"none","replication_status":"active","replication_status_reasons":[{"code":"cannot_reach_source_share","message":"The replication failover failed because the source share cannot be reached.","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}],"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"share","size":200,"source_share":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58","id":"0fe9e5d8-0a4d-4818-96ec-e99708644a58","name":"my-share","remote":{"region":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south","name":"us-south"}},"resource_type":"share"},"user_tags":["UserTags"],"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}`) + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"mount_targets":[{"access_control_mode":"security_group","created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c","id":"4cf9171a-0043-4434-8727-15b53dbc374c","lifecycle_state":"stable","mount_path":"10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e","name":"my-share-mount-target","primary_ip":{"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"},"resource_type":"share_mount_target","subnet":{"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"},"transit_encryption":"none","virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","id":"0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"},"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"}}]}`) } else { res.WriteHeader(400) } })) }) - It(`Use SharesPager.GetNext successfully`, func() { + It(`Use ShareMountTargetsPager.GetNext successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -55582,28 +60691,369 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listSharesOptionsModel := &vpcv1.ListSharesOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - Name: core.StringPtr("testString"), - Sort: core.StringPtr("name"), - ReplicationRole: core.StringPtr("none"), + listShareMountTargetsOptionsModel := &vpcv1.ListShareMountTargetsOptions{ + ShareID: core.StringPtr("testString"), + Name: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewShareMountTargetsPager(listShareMountTargetsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.ShareMountTarget + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) + }) + It(`Use ShareMountTargetsPager.GetAll 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()) + + listShareMountTargetsOptionsModel := &vpcv1.ListShareMountTargetsOptions{ + ShareID: core.StringPtr("testString"), + Name: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), } - pager, err := vpcService.NewSharesPager(listSharesOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) + pager, err := vpcService.NewShareMountTargetsPager(listShareMountTargetsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) + }) + }) + }) + Describe(`CreateShareMountTarget(createShareMountTargetOptions *CreateShareMountTargetOptions) - Operation response error`, func() { + version := "testString" + createShareMountTargetPath := "/shares/testString/mount_targets" + 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(createShareMountTargetPath)) + 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 CreateShareMountTarget 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 VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // 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 SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model + shareMountTargetVirtualNetworkInterfacePrototypeModel := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) + shareMountTargetVirtualNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + shareMountTargetVirtualNetworkInterfacePrototypeModel.AutoDelete = core.BoolPtr(false) + shareMountTargetVirtualNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + shareMountTargetVirtualNetworkInterfacePrototypeModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + shareMountTargetVirtualNetworkInterfacePrototypeModel.Name = core.StringPtr("my-virtual-network-interface") + shareMountTargetVirtualNetworkInterfacePrototypeModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + shareMountTargetVirtualNetworkInterfacePrototypeModel.ResourceGroup = resourceGroupIdentityModel + shareMountTargetVirtualNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + shareMountTargetVirtualNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + + // Construct an instance of the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model + shareMountTargetPrototypeModel := new(vpcv1.ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) + shareMountTargetPrototypeModel.Name = core.StringPtr("my-share-mount-target") + shareMountTargetPrototypeModel.TransitEncryption = core.StringPtr("none") + shareMountTargetPrototypeModel.VirtualNetworkInterface = shareMountTargetVirtualNetworkInterfacePrototypeModel + + // Construct an instance of the CreateShareMountTargetOptions model + createShareMountTargetOptionsModel := new(vpcv1.CreateShareMountTargetOptions) + createShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") + createShareMountTargetOptionsModel.ShareMountTargetPrototype = shareMountTargetPrototypeModel + createShareMountTargetOptionsModel.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.CreateShareMountTarget(createShareMountTargetOptionsModel) + 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.CreateShareMountTarget(createShareMountTargetOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateShareMountTarget(createShareMountTargetOptions *CreateShareMountTargetOptions)`, func() { + version := "testString" + createShareMountTargetPath := "/shares/testString/mount_targets" + 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(createShareMountTargetPath)) + 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", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "primary_ip": {"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"}, "resource_type": "share_mount_target", "subnet": {"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"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "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 CreateShareMountTarget 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 VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // 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 SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model + shareMountTargetVirtualNetworkInterfacePrototypeModel := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) + shareMountTargetVirtualNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + shareMountTargetVirtualNetworkInterfacePrototypeModel.AutoDelete = core.BoolPtr(false) + shareMountTargetVirtualNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + shareMountTargetVirtualNetworkInterfacePrototypeModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + shareMountTargetVirtualNetworkInterfacePrototypeModel.Name = core.StringPtr("my-virtual-network-interface") + shareMountTargetVirtualNetworkInterfacePrototypeModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + shareMountTargetVirtualNetworkInterfacePrototypeModel.ResourceGroup = resourceGroupIdentityModel + shareMountTargetVirtualNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + shareMountTargetVirtualNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + + // Construct an instance of the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model + shareMountTargetPrototypeModel := new(vpcv1.ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) + shareMountTargetPrototypeModel.Name = core.StringPtr("my-share-mount-target") + shareMountTargetPrototypeModel.TransitEncryption = core.StringPtr("none") + shareMountTargetPrototypeModel.VirtualNetworkInterface = shareMountTargetVirtualNetworkInterfacePrototypeModel + + // Construct an instance of the CreateShareMountTargetOptions model + createShareMountTargetOptionsModel := new(vpcv1.CreateShareMountTargetOptions) + createShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") + createShareMountTargetOptionsModel.ShareMountTargetPrototype = shareMountTargetPrototypeModel + createShareMountTargetOptionsModel.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.CreateShareMountTargetWithContext(ctx, createShareMountTargetOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateShareMountTarget(createShareMountTargetOptionsModel) + 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.CreateShareMountTargetWithContext(ctx, createShareMountTargetOptionsModel) + 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(createShareMountTargetPath)) + 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", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "primary_ip": {"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"}, "resource_type": "share_mount_target", "subnet": {"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"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "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 CreateShareMountTarget 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.CreateShareMountTarget(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // 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 SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model + shareMountTargetVirtualNetworkInterfacePrototypeModel := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) + shareMountTargetVirtualNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + shareMountTargetVirtualNetworkInterfacePrototypeModel.AutoDelete = core.BoolPtr(false) + shareMountTargetVirtualNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + shareMountTargetVirtualNetworkInterfacePrototypeModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + shareMountTargetVirtualNetworkInterfacePrototypeModel.Name = core.StringPtr("my-virtual-network-interface") + shareMountTargetVirtualNetworkInterfacePrototypeModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + shareMountTargetVirtualNetworkInterfacePrototypeModel.ResourceGroup = resourceGroupIdentityModel + shareMountTargetVirtualNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + shareMountTargetVirtualNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + + // Construct an instance of the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model + shareMountTargetPrototypeModel := new(vpcv1.ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) + shareMountTargetPrototypeModel.Name = core.StringPtr("my-share-mount-target") + shareMountTargetPrototypeModel.TransitEncryption = core.StringPtr("none") + shareMountTargetPrototypeModel.VirtualNetworkInterface = shareMountTargetVirtualNetworkInterfacePrototypeModel + + // Construct an instance of the CreateShareMountTargetOptions model + createShareMountTargetOptionsModel := new(vpcv1.CreateShareMountTargetOptions) + createShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") + createShareMountTargetOptionsModel.ShareMountTargetPrototype = shareMountTargetPrototypeModel + createShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateShareMountTarget(createShareMountTargetOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) - var allResults []vpcv1.Share - for pager.HasNext() { - nextPage, err := pager.GetNext() - Expect(err).To(BeNil()) - Expect(nextPage).ToNot(BeNil()) - allResults = append(allResults, nextPage...) - } - Expect(len(allResults)).To(Equal(2)) }) - It(`Use SharesPager.GetAll successfully`, func() { + It(`Invoke CreateShareMountTarget with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -55612,44 +61062,83 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listSharesOptionsModel := &vpcv1.ListSharesOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - Name: core.StringPtr("testString"), - Sort: core.StringPtr("name"), - ReplicationRole: core.StringPtr("none"), - } + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - pager, err := vpcService.NewSharesPager(listSharesOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - allResults, err := pager.GetAll() + // 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 SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model + shareMountTargetVirtualNetworkInterfacePrototypeModel := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) + shareMountTargetVirtualNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + shareMountTargetVirtualNetworkInterfacePrototypeModel.AutoDelete = core.BoolPtr(false) + shareMountTargetVirtualNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + shareMountTargetVirtualNetworkInterfacePrototypeModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + shareMountTargetVirtualNetworkInterfacePrototypeModel.Name = core.StringPtr("my-virtual-network-interface") + shareMountTargetVirtualNetworkInterfacePrototypeModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + shareMountTargetVirtualNetworkInterfacePrototypeModel.ResourceGroup = resourceGroupIdentityModel + shareMountTargetVirtualNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + shareMountTargetVirtualNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + + // Construct an instance of the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model + shareMountTargetPrototypeModel := new(vpcv1.ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) + shareMountTargetPrototypeModel.Name = core.StringPtr("my-share-mount-target") + shareMountTargetPrototypeModel.TransitEncryption = core.StringPtr("none") + shareMountTargetPrototypeModel.VirtualNetworkInterface = shareMountTargetVirtualNetworkInterfacePrototypeModel + + // Construct an instance of the CreateShareMountTargetOptions model + createShareMountTargetOptionsModel := new(vpcv1.CreateShareMountTargetOptions) + createShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") + createShareMountTargetOptionsModel.ShareMountTargetPrototype = shareMountTargetPrototypeModel + createShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") Expect(err).To(BeNil()) - Expect(allResults).ToNot(BeNil()) - Expect(len(allResults)).To(Equal(2)) + result, response, operationErr := vpcService.CreateShareMountTarget(createShareMountTargetOptionsModel) + 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 CreateShareMountTargetOptions model with no property values + createShareMountTargetOptionsModelNew := new(vpcv1.CreateShareMountTargetOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateShareMountTarget(createShareMountTargetOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() }) }) - }) - Describe(`CreateShare(createShareOptions *CreateShareOptions) - Operation response error`, func() { - version := "testString" - createSharePath := "/shares" - Context(`Using mock server endpoint with invalid JSON response`, func() { + 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() - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createSharePath)) - 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") + // Set success status code with no respoonse body res.WriteHeader(201) - fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateShare with error: Operation response processing error`, func() { + It(`Invoke CreateShareMountTarget successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -55658,6 +61147,12 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") @@ -55678,6 +61173,10 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model shareMountTargetVirtualNetworkInterfacePrototypeModel := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) + shareMountTargetVirtualNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + shareMountTargetVirtualNetworkInterfacePrototypeModel.AutoDelete = core.BoolPtr(false) + shareMountTargetVirtualNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + shareMountTargetVirtualNetworkInterfacePrototypeModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} shareMountTargetVirtualNetworkInterfacePrototypeModel.Name = core.StringPtr("my-virtual-network-interface") shareMountTargetVirtualNetworkInterfacePrototypeModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel shareMountTargetVirtualNetworkInterfacePrototypeModel.ResourceGroup = resourceGroupIdentityModel @@ -55690,62 +61189,66 @@ var _ = Describe(`VpcV1`, func() { shareMountTargetPrototypeModel.TransitEncryption = core.StringPtr("none") shareMountTargetPrototypeModel.VirtualNetworkInterface = shareMountTargetVirtualNetworkInterfacePrototypeModel - // Construct an instance of the ShareProfileIdentityByName model - shareProfileIdentityModel := new(vpcv1.ShareProfileIdentityByName) - shareProfileIdentityModel.Name = core.StringPtr("tier-3iops") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the SharePrototypeShareContext model - sharePrototypeShareContextModel := new(vpcv1.SharePrototypeShareContext) - sharePrototypeShareContextModel.Iops = core.Int64Ptr(int64(100)) - sharePrototypeShareContextModel.MountTargets = []vpcv1.ShareMountTargetPrototypeIntf{shareMountTargetPrototypeModel} - sharePrototypeShareContextModel.Name = core.StringPtr("my-share") - sharePrototypeShareContextModel.Profile = shareProfileIdentityModel - sharePrototypeShareContextModel.ReplicationCronSpec = core.StringPtr("0 */5 * * *") - sharePrototypeShareContextModel.ResourceGroup = resourceGroupIdentityModel - sharePrototypeShareContextModel.UserTags = []string{} - sharePrototypeShareContextModel.Zone = zoneIdentityModel + // Construct an instance of the CreateShareMountTargetOptions model + createShareMountTargetOptionsModel := new(vpcv1.CreateShareMountTargetOptions) + createShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") + createShareMountTargetOptionsModel.ShareMountTargetPrototype = shareMountTargetPrototypeModel + createShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + // Invoke operation + result, response, operationErr := vpcService.CreateShareMountTarget(createShareMountTargetOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) - // Construct an instance of the ShareInitialOwner model - shareInitialOwnerModel := new(vpcv1.ShareInitialOwner) - shareInitialOwnerModel.Gid = core.Int64Ptr(int64(50)) - shareInitialOwnerModel.Uid = core.Int64Ptr(int64(50)) + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteShareMountTarget(deleteShareMountTargetOptions *DeleteShareMountTargetOptions) - Operation response error`, func() { + version := "testString" + deleteShareMountTargetPath := "/shares/testString/mount_targets/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() - // Construct an instance of the SharePrototypeShareBySize model - sharePrototypeModel := new(vpcv1.SharePrototypeShareBySize) - sharePrototypeModel.Iops = core.Int64Ptr(int64(100)) - sharePrototypeModel.MountTargets = []vpcv1.ShareMountTargetPrototypeIntf{shareMountTargetPrototypeModel} - sharePrototypeModel.Name = core.StringPtr("my-share") - sharePrototypeModel.Profile = shareProfileIdentityModel - sharePrototypeModel.ReplicaShare = sharePrototypeShareContextModel - sharePrototypeModel.UserTags = []string{} - sharePrototypeModel.Zone = zoneIdentityModel - sharePrototypeModel.AccessControlMode = core.StringPtr("security_group") - sharePrototypeModel.EncryptionKey = encryptionKeyIdentityModel - sharePrototypeModel.InitialOwner = shareInitialOwnerModel - sharePrototypeModel.ResourceGroup = resourceGroupIdentityModel - sharePrototypeModel.Size = core.Int64Ptr(int64(200)) + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(deleteShareMountTargetPath)) + 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.Header().Set("Content-type", "application/json") + res.WriteHeader(202) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke DeleteShareMountTarget 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 CreateShareOptions model - createShareOptionsModel := new(vpcv1.CreateShareOptions) - createShareOptionsModel.SharePrototype = sharePrototypeModel - createShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteShareMountTargetOptions model + deleteShareMountTargetOptionsModel := new(vpcv1.DeleteShareMountTargetOptions) + deleteShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") + deleteShareMountTargetOptionsModel.ID = core.StringPtr("testString") + deleteShareMountTargetOptionsModel.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.CreateShare(createShareOptionsModel) + result, response, operationErr := vpcService.DeleteShareMountTarget(deleteShareMountTargetOptionsModel) 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.CreateShare(createShareOptionsModel) + result, response, operationErr = vpcService.DeleteShareMountTarget(deleteShareMountTargetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -55755,33 +61258,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateShare(createShareOptions *CreateShareOptions)`, func() { + Describe(`DeleteShareMountTarget(deleteShareMountTargetOptions *DeleteShareMountTargetOptions)`, func() { version := "testString" - createSharePath := "/shares" + deleteShareMountTargetPath := "/shares/testString/mount_targets/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(createSharePath)) - 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.EscapedPath()).To(Equal(deleteShareMountTargetPath)) + 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))})) @@ -55790,11 +61277,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "user_tags": ["UserTags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(202) + fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "primary_ip": {"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"}, "resource_type": "share_mount_target", "subnet": {"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"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "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 CreateShare successfully with retries`, func() { + It(`Invoke DeleteShareMountTarget successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -55804,96 +61291,252 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model - virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) - virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + // Construct an instance of the DeleteShareMountTargetOptions model + deleteShareMountTargetOptionsModel := new(vpcv1.DeleteShareMountTargetOptions) + deleteShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") + deleteShareMountTargetOptionsModel.ID = core.StringPtr("testString") + deleteShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := vpcService.DeleteShareMountTargetWithContext(ctx, deleteShareMountTargetOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - // Construct an instance of the SecurityGroupIdentityByID model - securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) - securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.DeleteShareMountTarget(deleteShareMountTargetOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = vpcService.DeleteShareMountTargetWithContext(ctx, deleteShareMountTargetOptionsModel) + 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() - // Construct an instance of the ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model - shareMountTargetVirtualNetworkInterfacePrototypeModel := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) - shareMountTargetVirtualNetworkInterfacePrototypeModel.Name = core.StringPtr("my-virtual-network-interface") - shareMountTargetVirtualNetworkInterfacePrototypeModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel - shareMountTargetVirtualNetworkInterfacePrototypeModel.ResourceGroup = resourceGroupIdentityModel - shareMountTargetVirtualNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - shareMountTargetVirtualNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(deleteShareMountTargetPath)) + Expect(req.Method).To(Equal("DELETE")) - // Construct an instance of the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model - shareMountTargetPrototypeModel := new(vpcv1.ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) - shareMountTargetPrototypeModel.Name = core.StringPtr("my-share-mount-target") - shareMountTargetPrototypeModel.TransitEncryption = core.StringPtr("none") - shareMountTargetPrototypeModel.VirtualNetworkInterface = shareMountTargetVirtualNetworkInterfacePrototypeModel + 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(202) + fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "primary_ip": {"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"}, "resource_type": "share_mount_target", "subnet": {"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"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "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 DeleteShareMountTarget 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 ShareProfileIdentityByName model - shareProfileIdentityModel := new(vpcv1.ShareProfileIdentityByName) - shareProfileIdentityModel.Name = core.StringPtr("tier-3iops") + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.DeleteShareMountTarget(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") + // Construct an instance of the DeleteShareMountTargetOptions model + deleteShareMountTargetOptionsModel := new(vpcv1.DeleteShareMountTargetOptions) + deleteShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") + deleteShareMountTargetOptionsModel.ID = core.StringPtr("testString") + deleteShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Construct an instance of the SharePrototypeShareContext model - sharePrototypeShareContextModel := new(vpcv1.SharePrototypeShareContext) - sharePrototypeShareContextModel.Iops = core.Int64Ptr(int64(100)) - sharePrototypeShareContextModel.MountTargets = []vpcv1.ShareMountTargetPrototypeIntf{shareMountTargetPrototypeModel} - sharePrototypeShareContextModel.Name = core.StringPtr("my-share") - sharePrototypeShareContextModel.Profile = shareProfileIdentityModel - sharePrototypeShareContextModel.ReplicationCronSpec = core.StringPtr("0 */5 * * *") - sharePrototypeShareContextModel.ResourceGroup = resourceGroupIdentityModel - sharePrototypeShareContextModel.UserTags = []string{} - sharePrototypeShareContextModel.Zone = zoneIdentityModel + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.DeleteShareMountTarget(deleteShareMountTargetOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + }) + It(`Invoke DeleteShareMountTarget 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 ShareInitialOwner model - shareInitialOwnerModel := new(vpcv1.ShareInitialOwner) - shareInitialOwnerModel.Gid = core.Int64Ptr(int64(50)) - shareInitialOwnerModel.Uid = core.Int64Ptr(int64(50)) + // Construct an instance of the DeleteShareMountTargetOptions model + deleteShareMountTargetOptionsModel := new(vpcv1.DeleteShareMountTargetOptions) + deleteShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") + deleteShareMountTargetOptionsModel.ID = core.StringPtr("testString") + deleteShareMountTargetOptionsModel.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.DeleteShareMountTarget(deleteShareMountTargetOptionsModel) + 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 DeleteShareMountTargetOptions model with no property values + deleteShareMountTargetOptionsModelNew := new(vpcv1.DeleteShareMountTargetOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.DeleteShareMountTarget(deleteShareMountTargetOptionsModelNew) + 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() - // Construct an instance of the SharePrototypeShareBySize model - sharePrototypeModel := new(vpcv1.SharePrototypeShareBySize) - sharePrototypeModel.Iops = core.Int64Ptr(int64(100)) - sharePrototypeModel.MountTargets = []vpcv1.ShareMountTargetPrototypeIntf{shareMountTargetPrototypeModel} - sharePrototypeModel.Name = core.StringPtr("my-share") - sharePrototypeModel.Profile = shareProfileIdentityModel - sharePrototypeModel.ReplicaShare = sharePrototypeShareContextModel - sharePrototypeModel.UserTags = []string{} - sharePrototypeModel.Zone = zoneIdentityModel - sharePrototypeModel.AccessControlMode = core.StringPtr("security_group") - sharePrototypeModel.EncryptionKey = encryptionKeyIdentityModel - sharePrototypeModel.InitialOwner = shareInitialOwnerModel - sharePrototypeModel.ResourceGroup = resourceGroupIdentityModel - sharePrototypeModel.Size = core.Int64Ptr(int64(200)) + // Set success status code with no respoonse body + res.WriteHeader(202) + })) + }) + It(`Invoke DeleteShareMountTarget 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 CreateShareOptions model - createShareOptionsModel := new(vpcv1.CreateShareOptions) - createShareOptionsModel.SharePrototype = sharePrototypeModel - createShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteShareMountTargetOptions model + deleteShareMountTargetOptionsModel := new(vpcv1.DeleteShareMountTargetOptions) + deleteShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") + deleteShareMountTargetOptionsModel.ID = core.StringPtr("testString") + deleteShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.DeleteShareMountTarget(deleteShareMountTargetOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetShareMountTarget(getShareMountTargetOptions *GetShareMountTargetOptions) - Operation response error`, func() { + version := "testString" + getShareMountTargetPath := "/shares/testString/mount_targets/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(getShareMountTargetPath)) + 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 GetShareMountTarget 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 GetShareMountTargetOptions model + getShareMountTargetOptionsModel := new(vpcv1.GetShareMountTargetOptions) + getShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") + getShareMountTargetOptionsModel.ID = core.StringPtr("testString") + getShareMountTargetOptionsModel.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.GetShareMountTarget(getShareMountTargetOptionsModel) + 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.GetShareMountTarget(getShareMountTargetOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetShareMountTarget(getShareMountTargetOptions *GetShareMountTargetOptions)`, func() { + version := "testString" + getShareMountTargetPath := "/shares/testString/mount_targets/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(getShareMountTargetPath)) + 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", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "primary_ip": {"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"}, "resource_type": "share_mount_target", "subnet": {"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"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "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 GetShareMountTarget 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 GetShareMountTargetOptions model + getShareMountTargetOptionsModel := new(vpcv1.GetShareMountTargetOptions) + getShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") + getShareMountTargetOptionsModel.ID = core.StringPtr("testString") + getShareMountTargetOptionsModel.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.CreateShareWithContext(ctx, createShareOptionsModel) + _, _, operationErr := vpcService.GetShareMountTargetWithContext(ctx, getShareMountTargetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateShare(createShareOptionsModel) + result, response, operationErr := vpcService.GetShareMountTarget(getShareMountTargetOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -55901,7 +61544,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreateShareWithContext(ctx, createShareOptionsModel) + _, _, operationErr = vpcService.GetShareMountTargetWithContext(ctx, getShareMountTargetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -55915,34 +61558,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createSharePath)) - 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.EscapedPath()).To(Equal(getShareMountTargetPath)) + 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(201) - fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "user_tags": ["UserTags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "primary_ip": {"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"}, "resource_type": "share_mount_target", "subnet": {"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"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "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 CreateShare successfully`, func() { + It(`Invoke GetShareMountTarget successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -55952,99 +61579,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreateShare(nil) + result, response, operationErr := vpcService.GetShareMountTarget(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model - virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) - virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // 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 SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model - shareMountTargetVirtualNetworkInterfacePrototypeModel := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) - shareMountTargetVirtualNetworkInterfacePrototypeModel.Name = core.StringPtr("my-virtual-network-interface") - shareMountTargetVirtualNetworkInterfacePrototypeModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel - shareMountTargetVirtualNetworkInterfacePrototypeModel.ResourceGroup = resourceGroupIdentityModel - shareMountTargetVirtualNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - shareMountTargetVirtualNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - - // Construct an instance of the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model - shareMountTargetPrototypeModel := new(vpcv1.ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) - shareMountTargetPrototypeModel.Name = core.StringPtr("my-share-mount-target") - shareMountTargetPrototypeModel.TransitEncryption = core.StringPtr("none") - shareMountTargetPrototypeModel.VirtualNetworkInterface = shareMountTargetVirtualNetworkInterfacePrototypeModel - - // Construct an instance of the ShareProfileIdentityByName model - shareProfileIdentityModel := new(vpcv1.ShareProfileIdentityByName) - shareProfileIdentityModel.Name = core.StringPtr("tier-3iops") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the SharePrototypeShareContext model - sharePrototypeShareContextModel := new(vpcv1.SharePrototypeShareContext) - sharePrototypeShareContextModel.Iops = core.Int64Ptr(int64(100)) - sharePrototypeShareContextModel.MountTargets = []vpcv1.ShareMountTargetPrototypeIntf{shareMountTargetPrototypeModel} - sharePrototypeShareContextModel.Name = core.StringPtr("my-share") - sharePrototypeShareContextModel.Profile = shareProfileIdentityModel - sharePrototypeShareContextModel.ReplicationCronSpec = core.StringPtr("0 */5 * * *") - sharePrototypeShareContextModel.ResourceGroup = resourceGroupIdentityModel - sharePrototypeShareContextModel.UserTags = []string{} - sharePrototypeShareContextModel.Zone = zoneIdentityModel - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the ShareInitialOwner model - shareInitialOwnerModel := new(vpcv1.ShareInitialOwner) - shareInitialOwnerModel.Gid = core.Int64Ptr(int64(50)) - shareInitialOwnerModel.Uid = core.Int64Ptr(int64(50)) - - // Construct an instance of the SharePrototypeShareBySize model - sharePrototypeModel := new(vpcv1.SharePrototypeShareBySize) - sharePrototypeModel.Iops = core.Int64Ptr(int64(100)) - sharePrototypeModel.MountTargets = []vpcv1.ShareMountTargetPrototypeIntf{shareMountTargetPrototypeModel} - sharePrototypeModel.Name = core.StringPtr("my-share") - sharePrototypeModel.Profile = shareProfileIdentityModel - sharePrototypeModel.ReplicaShare = sharePrototypeShareContextModel - sharePrototypeModel.UserTags = []string{} - sharePrototypeModel.Zone = zoneIdentityModel - sharePrototypeModel.AccessControlMode = core.StringPtr("security_group") - sharePrototypeModel.EncryptionKey = encryptionKeyIdentityModel - sharePrototypeModel.InitialOwner = shareInitialOwnerModel - sharePrototypeModel.ResourceGroup = resourceGroupIdentityModel - sharePrototypeModel.Size = core.Int64Ptr(int64(200)) - - // Construct an instance of the CreateShareOptions model - createShareOptionsModel := new(vpcv1.CreateShareOptions) - createShareOptionsModel.SharePrototype = sharePrototypeModel - createShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetShareMountTargetOptions model + getShareMountTargetOptionsModel := new(vpcv1.GetShareMountTargetOptions) + getShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") + getShareMountTargetOptionsModel.ID = core.StringPtr("testString") + getShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateShare(createShareOptionsModel) + result, response, operationErr = vpcService.GetShareMountTarget(getShareMountTargetOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateShare with error: Operation validation and request error`, func() { + It(`Invoke GetShareMountTarget with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -56053,97 +61606,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model - virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) - virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // 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 SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model - shareMountTargetVirtualNetworkInterfacePrototypeModel := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) - shareMountTargetVirtualNetworkInterfacePrototypeModel.Name = core.StringPtr("my-virtual-network-interface") - shareMountTargetVirtualNetworkInterfacePrototypeModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel - shareMountTargetVirtualNetworkInterfacePrototypeModel.ResourceGroup = resourceGroupIdentityModel - shareMountTargetVirtualNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - shareMountTargetVirtualNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - - // Construct an instance of the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model - shareMountTargetPrototypeModel := new(vpcv1.ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) - shareMountTargetPrototypeModel.Name = core.StringPtr("my-share-mount-target") - shareMountTargetPrototypeModel.TransitEncryption = core.StringPtr("none") - shareMountTargetPrototypeModel.VirtualNetworkInterface = shareMountTargetVirtualNetworkInterfacePrototypeModel - - // Construct an instance of the ShareProfileIdentityByName model - shareProfileIdentityModel := new(vpcv1.ShareProfileIdentityByName) - shareProfileIdentityModel.Name = core.StringPtr("tier-3iops") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the SharePrototypeShareContext model - sharePrototypeShareContextModel := new(vpcv1.SharePrototypeShareContext) - sharePrototypeShareContextModel.Iops = core.Int64Ptr(int64(100)) - sharePrototypeShareContextModel.MountTargets = []vpcv1.ShareMountTargetPrototypeIntf{shareMountTargetPrototypeModel} - sharePrototypeShareContextModel.Name = core.StringPtr("my-share") - sharePrototypeShareContextModel.Profile = shareProfileIdentityModel - sharePrototypeShareContextModel.ReplicationCronSpec = core.StringPtr("0 */5 * * *") - sharePrototypeShareContextModel.ResourceGroup = resourceGroupIdentityModel - sharePrototypeShareContextModel.UserTags = []string{} - sharePrototypeShareContextModel.Zone = zoneIdentityModel - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the ShareInitialOwner model - shareInitialOwnerModel := new(vpcv1.ShareInitialOwner) - shareInitialOwnerModel.Gid = core.Int64Ptr(int64(50)) - shareInitialOwnerModel.Uid = core.Int64Ptr(int64(50)) - - // Construct an instance of the SharePrototypeShareBySize model - sharePrototypeModel := new(vpcv1.SharePrototypeShareBySize) - sharePrototypeModel.Iops = core.Int64Ptr(int64(100)) - sharePrototypeModel.MountTargets = []vpcv1.ShareMountTargetPrototypeIntf{shareMountTargetPrototypeModel} - sharePrototypeModel.Name = core.StringPtr("my-share") - sharePrototypeModel.Profile = shareProfileIdentityModel - sharePrototypeModel.ReplicaShare = sharePrototypeShareContextModel - sharePrototypeModel.UserTags = []string{} - sharePrototypeModel.Zone = zoneIdentityModel - sharePrototypeModel.AccessControlMode = core.StringPtr("security_group") - sharePrototypeModel.EncryptionKey = encryptionKeyIdentityModel - sharePrototypeModel.InitialOwner = shareInitialOwnerModel - sharePrototypeModel.ResourceGroup = resourceGroupIdentityModel - sharePrototypeModel.Size = core.Int64Ptr(int64(200)) - - // Construct an instance of the CreateShareOptions model - createShareOptionsModel := new(vpcv1.CreateShareOptions) - createShareOptionsModel.SharePrototype = sharePrototypeModel - createShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetShareMountTargetOptions model + getShareMountTargetOptionsModel := new(vpcv1.GetShareMountTargetOptions) + getShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") + getShareMountTargetOptionsModel.ID = core.StringPtr("testString") + getShareMountTargetOptionsModel.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.CreateShare(createShareOptionsModel) + result, response, operationErr := vpcService.GetShareMountTarget(getShareMountTargetOptionsModel) 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 CreateShareOptions model with no property values - createShareOptionsModelNew := new(vpcv1.CreateShareOptions) + // Construct a second instance of the GetShareMountTargetOptions model with no property values + getShareMountTargetOptionsModelNew := new(vpcv1.GetShareMountTargetOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateShare(createShareOptionsModelNew) + result, response, operationErr = vpcService.GetShareMountTarget(getShareMountTargetOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -56158,10 +61637,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke CreateShare successfully`, func() { + It(`Invoke GetShareMountTarget successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -56170,88 +61649,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model - virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) - virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // 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 SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model - shareMountTargetVirtualNetworkInterfacePrototypeModel := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) - shareMountTargetVirtualNetworkInterfacePrototypeModel.Name = core.StringPtr("my-virtual-network-interface") - shareMountTargetVirtualNetworkInterfacePrototypeModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel - shareMountTargetVirtualNetworkInterfacePrototypeModel.ResourceGroup = resourceGroupIdentityModel - shareMountTargetVirtualNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - shareMountTargetVirtualNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - - // Construct an instance of the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model - shareMountTargetPrototypeModel := new(vpcv1.ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) - shareMountTargetPrototypeModel.Name = core.StringPtr("my-share-mount-target") - shareMountTargetPrototypeModel.TransitEncryption = core.StringPtr("none") - shareMountTargetPrototypeModel.VirtualNetworkInterface = shareMountTargetVirtualNetworkInterfacePrototypeModel - - // Construct an instance of the ShareProfileIdentityByName model - shareProfileIdentityModel := new(vpcv1.ShareProfileIdentityByName) - shareProfileIdentityModel.Name = core.StringPtr("tier-3iops") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the SharePrototypeShareContext model - sharePrototypeShareContextModel := new(vpcv1.SharePrototypeShareContext) - sharePrototypeShareContextModel.Iops = core.Int64Ptr(int64(100)) - sharePrototypeShareContextModel.MountTargets = []vpcv1.ShareMountTargetPrototypeIntf{shareMountTargetPrototypeModel} - sharePrototypeShareContextModel.Name = core.StringPtr("my-share") - sharePrototypeShareContextModel.Profile = shareProfileIdentityModel - sharePrototypeShareContextModel.ReplicationCronSpec = core.StringPtr("0 */5 * * *") - sharePrototypeShareContextModel.ResourceGroup = resourceGroupIdentityModel - sharePrototypeShareContextModel.UserTags = []string{} - sharePrototypeShareContextModel.Zone = zoneIdentityModel - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the ShareInitialOwner model - shareInitialOwnerModel := new(vpcv1.ShareInitialOwner) - shareInitialOwnerModel.Gid = core.Int64Ptr(int64(50)) - shareInitialOwnerModel.Uid = core.Int64Ptr(int64(50)) - - // Construct an instance of the SharePrototypeShareBySize model - sharePrototypeModel := new(vpcv1.SharePrototypeShareBySize) - sharePrototypeModel.Iops = core.Int64Ptr(int64(100)) - sharePrototypeModel.MountTargets = []vpcv1.ShareMountTargetPrototypeIntf{shareMountTargetPrototypeModel} - sharePrototypeModel.Name = core.StringPtr("my-share") - sharePrototypeModel.Profile = shareProfileIdentityModel - sharePrototypeModel.ReplicaShare = sharePrototypeShareContextModel - sharePrototypeModel.UserTags = []string{} - sharePrototypeModel.Zone = zoneIdentityModel - sharePrototypeModel.AccessControlMode = core.StringPtr("security_group") - sharePrototypeModel.EncryptionKey = encryptionKeyIdentityModel - sharePrototypeModel.InitialOwner = shareInitialOwnerModel - sharePrototypeModel.ResourceGroup = resourceGroupIdentityModel - sharePrototypeModel.Size = core.Int64Ptr(int64(200)) - - // Construct an instance of the CreateShareOptions model - createShareOptionsModel := new(vpcv1.CreateShareOptions) - createShareOptionsModel.SharePrototype = sharePrototypeModel - createShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetShareMountTargetOptions model + getShareMountTargetOptionsModel := new(vpcv1.GetShareMountTargetOptions) + getShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") + getShareMountTargetOptionsModel.ID = core.StringPtr("testString") + getShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.CreateShare(createShareOptionsModel) + result, response, operationErr := vpcService.GetShareMountTarget(getShareMountTargetOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -56263,27 +61668,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteShare(deleteShareOptions *DeleteShareOptions) - Operation response error`, func() { + Describe(`UpdateShareMountTarget(updateShareMountTargetOptions *UpdateShareMountTargetOptions) - Operation response error`, func() { version := "testString" - deleteSharePath := "/shares/testString" + updateShareMountTargetPath := "/shares/testString/mount_targets/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(deleteSharePath)) - 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.EscapedPath()).To(Equal(updateShareMountTargetPath)) + 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(202) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke DeleteShare with error: Operation response processing error`, func() { + It(`Invoke UpdateShareMountTarget with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -56292,20 +61695,27 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteShareOptions model - deleteShareOptionsModel := new(vpcv1.DeleteShareOptions) - deleteShareOptionsModel.ID = core.StringPtr("testString") - deleteShareOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - deleteShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ShareMountTargetPatch model + shareMountTargetPatchModel := new(vpcv1.ShareMountTargetPatch) + shareMountTargetPatchModel.Name = core.StringPtr("my-share-mount-target") + shareMountTargetPatchModelAsPatch, asPatchErr := shareMountTargetPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateShareMountTargetOptions model + updateShareMountTargetOptionsModel := new(vpcv1.UpdateShareMountTargetOptions) + updateShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") + updateShareMountTargetOptionsModel.ID = core.StringPtr("testString") + updateShareMountTargetOptionsModel.ShareMountTargetPatch = shareMountTargetPatchModelAsPatch + updateShareMountTargetOptionsModel.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.DeleteShare(deleteShareOptionsModel) + result, response, operationErr := vpcService.UpdateShareMountTarget(updateShareMountTargetOptionsModel) 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.DeleteShare(deleteShareOptionsModel) + result, response, operationErr = vpcService.UpdateShareMountTarget(updateShareMountTargetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -56315,20 +61725,34 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteShare(deleteShareOptions *DeleteShareOptions)`, func() { + Describe(`UpdateShareMountTarget(updateShareMountTargetOptions *UpdateShareMountTargetOptions)`, func() { version := "testString" - deleteSharePath := "/shares/testString" + updateShareMountTargetPath := "/shares/testString/mount_targets/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(deleteSharePath)) - Expect(req.Method).To(Equal("DELETE")) + Expect(req.URL.EscapedPath()).To(Equal(updateShareMountTargetPath)) + 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 @@ -56336,11 +61760,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) - fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "user_tags": ["UserTags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "primary_ip": {"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"}, "resource_type": "share_mount_target", "subnet": {"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"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "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 DeleteShare successfully with retries`, func() { + It(`Invoke UpdateShareMountTarget successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -56350,22 +61774,29 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the DeleteShareOptions model - deleteShareOptionsModel := new(vpcv1.DeleteShareOptions) - deleteShareOptionsModel.ID = core.StringPtr("testString") - deleteShareOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - deleteShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ShareMountTargetPatch model + shareMountTargetPatchModel := new(vpcv1.ShareMountTargetPatch) + shareMountTargetPatchModel.Name = core.StringPtr("my-share-mount-target") + shareMountTargetPatchModelAsPatch, asPatchErr := shareMountTargetPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateShareMountTargetOptions model + updateShareMountTargetOptionsModel := new(vpcv1.UpdateShareMountTargetOptions) + updateShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") + updateShareMountTargetOptionsModel.ID = core.StringPtr("testString") + updateShareMountTargetOptionsModel.ShareMountTargetPatch = shareMountTargetPatchModelAsPatch + updateShareMountTargetOptionsModel.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.DeleteShareWithContext(ctx, deleteShareOptionsModel) + _, _, operationErr := vpcService.UpdateShareMountTargetWithContext(ctx, updateShareMountTargetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.DeleteShare(deleteShareOptionsModel) + result, response, operationErr := vpcService.UpdateShareMountTarget(updateShareMountTargetOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -56373,7 +61804,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.DeleteShareWithContext(ctx, deleteShareOptionsModel) + _, _, operationErr = vpcService.UpdateShareMountTargetWithContext(ctx, updateShareMountTargetOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -56387,20 +61818,34 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteSharePath)) - Expect(req.Method).To(Equal("DELETE")) + Expect(req.URL.EscapedPath()).To(Equal(updateShareMountTargetPath)) + 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(202) - fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "user_tags": ["UserTags"], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "primary_ip": {"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"}, "resource_type": "share_mount_target", "subnet": {"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"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "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 DeleteShare successfully`, func() { + It(`Invoke UpdateShareMountTarget successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -56410,25 +61855,32 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.DeleteShare(nil) + result, response, operationErr := vpcService.UpdateShareMountTarget(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the DeleteShareOptions model - deleteShareOptionsModel := new(vpcv1.DeleteShareOptions) - deleteShareOptionsModel.ID = core.StringPtr("testString") - deleteShareOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - deleteShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ShareMountTargetPatch model + shareMountTargetPatchModel := new(vpcv1.ShareMountTargetPatch) + shareMountTargetPatchModel.Name = core.StringPtr("my-share-mount-target") + shareMountTargetPatchModelAsPatch, asPatchErr := shareMountTargetPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateShareMountTargetOptions model + updateShareMountTargetOptionsModel := new(vpcv1.UpdateShareMountTargetOptions) + updateShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") + updateShareMountTargetOptionsModel.ID = core.StringPtr("testString") + updateShareMountTargetOptionsModel.ShareMountTargetPatch = shareMountTargetPatchModelAsPatch + updateShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.DeleteShare(deleteShareOptionsModel) + result, response, operationErr = vpcService.UpdateShareMountTarget(updateShareMountTargetOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke DeleteShare with error: Operation validation and request error`, func() { + It(`Invoke UpdateShareMountTarget with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -56437,23 +61889,30 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteShareOptions model - deleteShareOptionsModel := new(vpcv1.DeleteShareOptions) - deleteShareOptionsModel.ID = core.StringPtr("testString") - deleteShareOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - deleteShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ShareMountTargetPatch model + shareMountTargetPatchModel := new(vpcv1.ShareMountTargetPatch) + shareMountTargetPatchModel.Name = core.StringPtr("my-share-mount-target") + shareMountTargetPatchModelAsPatch, asPatchErr := shareMountTargetPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateShareMountTargetOptions model + updateShareMountTargetOptionsModel := new(vpcv1.UpdateShareMountTargetOptions) + updateShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") + updateShareMountTargetOptionsModel.ID = core.StringPtr("testString") + updateShareMountTargetOptionsModel.ShareMountTargetPatch = shareMountTargetPatchModelAsPatch + updateShareMountTargetOptionsModel.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.DeleteShare(deleteShareOptionsModel) + result, response, operationErr := vpcService.UpdateShareMountTarget(updateShareMountTargetOptionsModel) 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 DeleteShareOptions model with no property values - deleteShareOptionsModelNew := new(vpcv1.DeleteShareOptions) + // Construct a second instance of the UpdateShareMountTargetOptions model with no property values + updateShareMountTargetOptionsModelNew := new(vpcv1.UpdateShareMountTargetOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.DeleteShare(deleteShareOptionsModelNew) + result, response, operationErr = vpcService.UpdateShareMountTarget(updateShareMountTargetOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -56462,16 +61921,68 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) - Context(`Using mock server endpoint with missing response body`, func() { + 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 UpdateShareMountTarget 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 ShareMountTargetPatch model + shareMountTargetPatchModel := new(vpcv1.ShareMountTargetPatch) + shareMountTargetPatchModel.Name = core.StringPtr("my-share-mount-target") + shareMountTargetPatchModelAsPatch, asPatchErr := shareMountTargetPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateShareMountTargetOptions model + updateShareMountTargetOptionsModel := new(vpcv1.UpdateShareMountTargetOptions) + updateShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") + updateShareMountTargetOptionsModel.ID = core.StringPtr("testString") + updateShareMountTargetOptionsModel.ShareMountTargetPatch = shareMountTargetPatchModelAsPatch + updateShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.UpdateShareMountTarget(updateShareMountTargetOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteShareSource(deleteShareSourceOptions *DeleteShareSourceOptions)`, func() { + version := "testString" + deleteShareSourcePath := "/shares/testString/source" + Context(`Using mock server endpoint`, 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 + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(deleteShareSourcePath)) + 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 DeleteShare successfully`, func() { + It(`Invoke DeleteShareSource successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -56480,35 +61991,63 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteShareOptions model - deleteShareOptionsModel := new(vpcv1.DeleteShareOptions) - deleteShareOptionsModel.ID = core.StringPtr("testString") - deleteShareOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - deleteShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with nil options model (negative test) + response, operationErr := vpcService.DeleteShareSource(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) - // Invoke operation - result, response, operationErr := vpcService.DeleteShare(deleteShareOptionsModel) + // Construct an instance of the DeleteShareSourceOptions model + deleteShareSourceOptionsModel := new(vpcv1.DeleteShareSourceOptions) + deleteShareSourceOptionsModel.ShareID = core.StringPtr("testString") + deleteShareSourceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteShareSource(deleteShareSourceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteShareSource 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()) - // Verify a nil result - Expect(result).To(BeNil()) + // Construct an instance of the DeleteShareSourceOptions model + deleteShareSourceOptionsModel := new(vpcv1.DeleteShareSourceOptions) + deleteShareSourceOptionsModel.ShareID = core.StringPtr("testString") + deleteShareSourceOptionsModel.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.DeleteShareSource(deleteShareSourceOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteShareSourceOptions model with no property values + deleteShareSourceOptionsModelNew := new(vpcv1.DeleteShareSourceOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteShareSource(deleteShareSourceOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`GetShare(getShareOptions *GetShareOptions) - Operation response error`, func() { + Describe(`GetShareSource(getShareSourceOptions *GetShareSourceOptions) - Operation response error`, func() { version := "testString" - getSharePath := "/shares/testString" + getShareSourcePath := "/shares/testString/source" 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(getSharePath)) + Expect(req.URL.EscapedPath()).To(Equal(getShareSourcePath)) 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))})) @@ -56517,7 +62056,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetShare with error: Operation response processing error`, func() { + It(`Invoke GetShareSource with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -56526,19 +62065,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetShareOptions model - getShareOptionsModel := new(vpcv1.GetShareOptions) - getShareOptionsModel.ID = core.StringPtr("testString") - getShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetShareSourceOptions model + getShareSourceOptionsModel := new(vpcv1.GetShareSourceOptions) + getShareSourceOptionsModel.ShareID = core.StringPtr("testString") + getShareSourceOptionsModel.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.GetShare(getShareOptionsModel) + result, response, operationErr := vpcService.GetShareSource(getShareSourceOptionsModel) 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.GetShare(getShareOptionsModel) + result, response, operationErr = vpcService.GetShareSource(getShareSourceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -56548,16 +62087,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetShare(getShareOptions *GetShareOptions)`, func() { + Describe(`GetShareSource(getShareSourceOptions *GetShareSourceOptions)`, func() { version := "testString" - getSharePath := "/shares/testString" + getShareSourcePath := "/shares/testString/source" 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(getSharePath)) + Expect(req.URL.EscapedPath()).To(Equal(getShareSourcePath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -56568,10 +62107,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "user_tags": ["UserTags"], "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", `{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}`) })) }) - It(`Invoke GetShare successfully with retries`, func() { + It(`Invoke GetShareSource successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -56581,21 +62120,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetShareOptions model - getShareOptionsModel := new(vpcv1.GetShareOptions) - getShareOptionsModel.ID = core.StringPtr("testString") - getShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetShareSourceOptions model + getShareSourceOptionsModel := new(vpcv1.GetShareSourceOptions) + getShareSourceOptionsModel.ShareID = core.StringPtr("testString") + getShareSourceOptionsModel.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.GetShareWithContext(ctx, getShareOptionsModel) + _, _, operationErr := vpcService.GetShareSourceWithContext(ctx, getShareSourceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetShare(getShareOptionsModel) + result, response, operationErr := vpcService.GetShareSource(getShareSourceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -56603,7 +62142,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetShareWithContext(ctx, getShareOptionsModel) + _, _, operationErr = vpcService.GetShareSourceWithContext(ctx, getShareSourceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -56617,7 +62156,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSharePath)) + Expect(req.URL.EscapedPath()).To(Equal(getShareSourcePath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -56625,10 +62164,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "user_tags": ["UserTags"], "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", `{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}`) })) }) - It(`Invoke GetShare successfully`, func() { + It(`Invoke GetShareSource successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -56638,24 +62177,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetShare(nil) + result, response, operationErr := vpcService.GetShareSource(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetShareOptions model - getShareOptionsModel := new(vpcv1.GetShareOptions) - getShareOptionsModel.ID = core.StringPtr("testString") - getShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetShareSourceOptions model + getShareSourceOptionsModel := new(vpcv1.GetShareSourceOptions) + getShareSourceOptionsModel.ShareID = core.StringPtr("testString") + getShareSourceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetShare(getShareOptionsModel) + result, response, operationErr = vpcService.GetShareSource(getShareSourceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetShare with error: Operation validation and request error`, func() { + It(`Invoke GetShareSource with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -56664,22 +62203,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetShareOptions model - getShareOptionsModel := new(vpcv1.GetShareOptions) - getShareOptionsModel.ID = core.StringPtr("testString") - getShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetShareSourceOptions model + getShareSourceOptionsModel := new(vpcv1.GetShareSourceOptions) + getShareSourceOptionsModel.ShareID = core.StringPtr("testString") + getShareSourceOptionsModel.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.GetShare(getShareOptionsModel) + result, response, operationErr := vpcService.GetShareSource(getShareSourceOptionsModel) 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 GetShareOptions model with no property values - getShareOptionsModelNew := new(vpcv1.GetShareOptions) + // Construct a second instance of the GetShareSourceOptions model with no property values + getShareSourceOptionsModelNew := new(vpcv1.GetShareSourceOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetShare(getShareOptionsModelNew) + result, response, operationErr = vpcService.GetShareSource(getShareSourceOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -56697,7 +62236,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetShare successfully`, func() { + It(`Invoke GetShareSource successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -56706,13 +62245,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetShareOptions model - getShareOptionsModel := new(vpcv1.GetShareOptions) - getShareOptionsModel.ID = core.StringPtr("testString") - getShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetShareSourceOptions model + getShareSourceOptionsModel := new(vpcv1.GetShareSourceOptions) + getShareSourceOptionsModel.ShareID = core.StringPtr("testString") + getShareSourceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetShare(getShareOptionsModel) + result, response, operationErr := vpcService.GetShareSource(getShareSourceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -56724,19 +62263,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateShare(updateShareOptions *UpdateShareOptions) - Operation response error`, func() { + Describe(`ListRegions(listRegionsOptions *ListRegionsOptions) - Operation response error`, func() { version := "testString" - updateSharePath := "/shares/testString" + listRegionsPath := "/regions" 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(updateSharePath)) - 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.EscapedPath()).To(Equal(listRegionsPath)) + 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") @@ -56744,7 +62281,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateShare with error: Operation response processing error`, func() { + It(`Invoke ListRegions with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -56753,37 +62290,18 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ShareProfileIdentityByName model - shareProfileIdentityModel := new(vpcv1.ShareProfileIdentityByName) - shareProfileIdentityModel.Name = core.StringPtr("tier-3iops") - - // Construct an instance of the SharePatch model - sharePatchModel := new(vpcv1.SharePatch) - sharePatchModel.AccessControlMode = core.StringPtr("security_group") - sharePatchModel.Iops = core.Int64Ptr(int64(100)) - sharePatchModel.Name = core.StringPtr("my-share") - sharePatchModel.Profile = shareProfileIdentityModel - sharePatchModel.ReplicationCronSpec = core.StringPtr("0 */5 * * *") - sharePatchModel.Size = core.Int64Ptr(int64(200)) - sharePatchModel.UserTags = []string{"testString"} - sharePatchModelAsPatch, asPatchErr := sharePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateShareOptions model - updateShareOptionsModel := new(vpcv1.UpdateShareOptions) - updateShareOptionsModel.ID = core.StringPtr("testString") - updateShareOptionsModel.SharePatch = sharePatchModelAsPatch - updateShareOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListRegionsOptions model + listRegionsOptionsModel := new(vpcv1.ListRegionsOptions) + listRegionsOptionsModel.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.UpdateShare(updateShareOptionsModel) + result, response, operationErr := vpcService.ListRegions(listRegionsOptionsModel) 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.UpdateShare(updateShareOptionsModel) + result, response, operationErr = vpcService.ListRegions(listRegionsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -56793,36 +62311,18 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateShare(updateShareOptions *UpdateShareOptions)`, func() { + Describe(`ListRegions(listRegionsOptions *ListRegionsOptions)`, func() { version := "testString" - updateSharePath := "/shares/testString" + listRegionsPath := "/regions" 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(updateSharePath)) - 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.EscapedPath()).To(Equal(listRegionsPath)) + Expect(req.Method).To(Equal("GET")) - 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 @@ -56831,10 +62331,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "user_tags": ["UserTags"], "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", `{"regions": [{"endpoint": "Endpoint", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south", "status": "available"}]}`) })) }) - It(`Invoke UpdateShare successfully with retries`, func() { + It(`Invoke ListRegions successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -56844,39 +62344,20 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ShareProfileIdentityByName model - shareProfileIdentityModel := new(vpcv1.ShareProfileIdentityByName) - shareProfileIdentityModel.Name = core.StringPtr("tier-3iops") - - // Construct an instance of the SharePatch model - sharePatchModel := new(vpcv1.SharePatch) - sharePatchModel.AccessControlMode = core.StringPtr("security_group") - sharePatchModel.Iops = core.Int64Ptr(int64(100)) - sharePatchModel.Name = core.StringPtr("my-share") - sharePatchModel.Profile = shareProfileIdentityModel - sharePatchModel.ReplicationCronSpec = core.StringPtr("0 */5 * * *") - sharePatchModel.Size = core.Int64Ptr(int64(200)) - sharePatchModel.UserTags = []string{"testString"} - sharePatchModelAsPatch, asPatchErr := sharePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateShareOptions model - updateShareOptionsModel := new(vpcv1.UpdateShareOptions) - updateShareOptionsModel.ID = core.StringPtr("testString") - updateShareOptionsModel.SharePatch = sharePatchModelAsPatch - updateShareOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListRegionsOptions model + listRegionsOptionsModel := new(vpcv1.ListRegionsOptions) + listRegionsOptionsModel.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.UpdateShareWithContext(ctx, updateShareOptionsModel) + _, _, operationErr := vpcService.ListRegionsWithContext(ctx, listRegionsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateShare(updateShareOptionsModel) + result, response, operationErr := vpcService.ListRegions(listRegionsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -56884,7 +62365,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateShareWithContext(ctx, updateShareOptionsModel) + _, _, operationErr = vpcService.ListRegionsWithContext(ctx, listRegionsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -56898,36 +62379,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateSharePath)) - 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.EscapedPath()).To(Equal(listRegionsPath)) + Expect(req.Method).To(Equal("GET")) - 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", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/123456:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "iops": 100, "latest_job": {"status": "cancelled", "status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "type": "replication_failover"}, "latest_sync": {"completed_at": "2019-01-01T12:00:00.000Z", "data_transferred": 0, "started_at": "2019-01-01T12:00:00.000Z"}, "lifecycle_state": "stable", "mount_targets": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}], "name": "my-share", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/share/profiles/tier-3iops", "name": "tier-3iops", "resource_type": "share_profile"}, "replica_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "replication_cron_spec": "0 */5 * * *", "replication_role": "none", "replication_status": "active", "replication_status_reasons": [{"code": "cannot_reach_source_share", "message": "The replication failover failed because the source share cannot be reached.", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-planning"}], "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "share", "size": 200, "source_share": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}, "user_tags": ["UserTags"], "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", `{"regions": [{"endpoint": "Endpoint", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south", "status": "available"}]}`) })) }) - It(`Invoke UpdateShare successfully`, func() { + It(`Invoke ListRegions successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -56937,42 +62400,23 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateShare(nil) + result, response, operationErr := vpcService.ListRegions(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ShareProfileIdentityByName model - shareProfileIdentityModel := new(vpcv1.ShareProfileIdentityByName) - shareProfileIdentityModel.Name = core.StringPtr("tier-3iops") - - // Construct an instance of the SharePatch model - sharePatchModel := new(vpcv1.SharePatch) - sharePatchModel.AccessControlMode = core.StringPtr("security_group") - sharePatchModel.Iops = core.Int64Ptr(int64(100)) - sharePatchModel.Name = core.StringPtr("my-share") - sharePatchModel.Profile = shareProfileIdentityModel - sharePatchModel.ReplicationCronSpec = core.StringPtr("0 */5 * * *") - sharePatchModel.Size = core.Int64Ptr(int64(200)) - sharePatchModel.UserTags = []string{"testString"} - sharePatchModelAsPatch, asPatchErr := sharePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateShareOptions model - updateShareOptionsModel := new(vpcv1.UpdateShareOptions) - updateShareOptionsModel.ID = core.StringPtr("testString") - updateShareOptionsModel.SharePatch = sharePatchModelAsPatch - updateShareOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListRegionsOptions model + listRegionsOptionsModel := new(vpcv1.ListRegionsOptions) + listRegionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateShare(updateShareOptionsModel) + result, response, operationErr = vpcService.ListRegions(listRegionsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateShare with error: Operation validation and request error`, func() { + It(`Invoke ListRegions with error: Operation request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -56981,43 +62425,17 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ShareProfileIdentityByName model - shareProfileIdentityModel := new(vpcv1.ShareProfileIdentityByName) - shareProfileIdentityModel.Name = core.StringPtr("tier-3iops") - - // Construct an instance of the SharePatch model - sharePatchModel := new(vpcv1.SharePatch) - sharePatchModel.AccessControlMode = core.StringPtr("security_group") - sharePatchModel.Iops = core.Int64Ptr(int64(100)) - sharePatchModel.Name = core.StringPtr("my-share") - sharePatchModel.Profile = shareProfileIdentityModel - sharePatchModel.ReplicationCronSpec = core.StringPtr("0 */5 * * *") - sharePatchModel.Size = core.Int64Ptr(int64(200)) - sharePatchModel.UserTags = []string{"testString"} - sharePatchModelAsPatch, asPatchErr := sharePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateShareOptions model - updateShareOptionsModel := new(vpcv1.UpdateShareOptions) - updateShareOptionsModel.ID = core.StringPtr("testString") - updateShareOptionsModel.SharePatch = sharePatchModelAsPatch - updateShareOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListRegionsOptions model + listRegionsOptionsModel := new(vpcv1.ListRegionsOptions) + listRegionsOptionsModel.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.UpdateShare(updateShareOptionsModel) + result, response, operationErr := vpcService.ListRegions(listRegionsOptionsModel) 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 UpdateShareOptions model with no property values - updateShareOptionsModelNew := new(vpcv1.UpdateShareOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateShare(updateShareOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -57032,7 +62450,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateShare successfully`, func() { + It(`Invoke ListRegions successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -57041,31 +62459,12 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ShareProfileIdentityByName model - shareProfileIdentityModel := new(vpcv1.ShareProfileIdentityByName) - shareProfileIdentityModel.Name = core.StringPtr("tier-3iops") - - // Construct an instance of the SharePatch model - sharePatchModel := new(vpcv1.SharePatch) - sharePatchModel.AccessControlMode = core.StringPtr("security_group") - sharePatchModel.Iops = core.Int64Ptr(int64(100)) - sharePatchModel.Name = core.StringPtr("my-share") - sharePatchModel.Profile = shareProfileIdentityModel - sharePatchModel.ReplicationCronSpec = core.StringPtr("0 */5 * * *") - sharePatchModel.Size = core.Int64Ptr(int64(200)) - sharePatchModel.UserTags = []string{"testString"} - sharePatchModelAsPatch, asPatchErr := sharePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateShareOptions model - updateShareOptionsModel := new(vpcv1.UpdateShareOptions) - updateShareOptionsModel.ID = core.StringPtr("testString") - updateShareOptionsModel.SharePatch = sharePatchModelAsPatch - updateShareOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListRegionsOptions model + listRegionsOptionsModel := new(vpcv1.ListRegionsOptions) + listRegionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.UpdateShare(updateShareOptionsModel) + result, response, operationErr := vpcService.ListRegions(listRegionsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -57077,121 +62476,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`FailoverShare(failoverShareOptions *FailoverShareOptions)`, func() { - version := "testString" - failoverSharePath := "/shares/testString/failover" - 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(failoverSharePath)) - 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))})) - res.WriteHeader(202) - })) - }) - It(`Invoke FailoverShare 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.FailoverShare(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the FailoverShareOptions model - failoverShareOptionsModel := new(vpcv1.FailoverShareOptions) - failoverShareOptionsModel.ShareID = core.StringPtr("testString") - failoverShareOptionsModel.FallbackPolicy = core.StringPtr("fail") - failoverShareOptionsModel.Timeout = core.Int64Ptr(int64(600)) - failoverShareOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.FailoverShare(failoverShareOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke FailoverShare 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 FailoverShareOptions model - failoverShareOptionsModel := new(vpcv1.FailoverShareOptions) - failoverShareOptionsModel.ShareID = core.StringPtr("testString") - failoverShareOptionsModel.FallbackPolicy = core.StringPtr("fail") - failoverShareOptionsModel.Timeout = core.Int64Ptr(int64(600)) - failoverShareOptionsModel.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.FailoverShare(failoverShareOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the FailoverShareOptions model with no property values - failoverShareOptionsModelNew := new(vpcv1.FailoverShareOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.FailoverShare(failoverShareOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListShareMountTargets(listShareMountTargetsOptions *ListShareMountTargetsOptions) - Operation response error`, func() { + Describe(`GetRegion(getRegionOptions *GetRegionOptions) - Operation response error`, func() { version := "testString" - listShareMountTargetsPath := "/shares/testString/mount_targets" + getRegionPath := "/regions/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(listShareMountTargetsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getRegionPath)) 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(10))})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListShareMountTargets with error: Operation response processing error`, func() { + It(`Invoke GetRegion with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -57200,22 +62503,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListShareMountTargetsOptions model - listShareMountTargetsOptionsModel := new(vpcv1.ListShareMountTargetsOptions) - listShareMountTargetsOptionsModel.ShareID = core.StringPtr("testString") - listShareMountTargetsOptionsModel.Name = core.StringPtr("testString") - listShareMountTargetsOptionsModel.Start = core.StringPtr("testString") - listShareMountTargetsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listShareMountTargetsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetRegionOptions model + getRegionOptionsModel := new(vpcv1.GetRegionOptions) + getRegionOptionsModel.Name = core.StringPtr("testString") + getRegionOptionsModel.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.ListShareMountTargets(listShareMountTargetsOptionsModel) + result, response, operationErr := vpcService.GetRegion(getRegionOptionsModel) 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.ListShareMountTargets(listShareMountTargetsOptionsModel) + result, response, operationErr = vpcService.GetRegion(getRegionOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -57225,33 +62525,30 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListShareMountTargets(listShareMountTargetsOptions *ListShareMountTargetsOptions)`, func() { + Describe(`GetRegion(getRegionOptions *GetRegionOptions)`, func() { version := "testString" - listShareMountTargetsPath := "/shares/testString/mount_targets" + getRegionPath := "/regions/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(listShareMountTargetsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getRegionPath)) 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(10))})) // 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/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets?limit=20"}, "limit": 20, "mount_targets": [{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "primary_ip": {"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"}, "resource_type": "share_mount_target", "subnet": {"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"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "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"}}], "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"endpoint": "Endpoint", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south", "status": "available"}`) })) }) - It(`Invoke ListShareMountTargets successfully with retries`, func() { + It(`Invoke GetRegion successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -57261,24 +62558,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListShareMountTargetsOptions model - listShareMountTargetsOptionsModel := new(vpcv1.ListShareMountTargetsOptions) - listShareMountTargetsOptionsModel.ShareID = core.StringPtr("testString") - listShareMountTargetsOptionsModel.Name = core.StringPtr("testString") - listShareMountTargetsOptionsModel.Start = core.StringPtr("testString") - listShareMountTargetsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listShareMountTargetsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetRegionOptions model + getRegionOptionsModel := new(vpcv1.GetRegionOptions) + getRegionOptionsModel.Name = core.StringPtr("testString") + getRegionOptionsModel.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.ListShareMountTargetsWithContext(ctx, listShareMountTargetsOptionsModel) + _, _, operationErr := vpcService.GetRegionWithContext(ctx, getRegionOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListShareMountTargets(listShareMountTargetsOptionsModel) + result, response, operationErr := vpcService.GetRegion(getRegionOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -57286,7 +62580,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListShareMountTargetsWithContext(ctx, listShareMountTargetsOptionsModel) + _, _, operationErr = vpcService.GetRegionWithContext(ctx, getRegionOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -57300,21 +62594,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listShareMountTargetsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getRegionPath)) 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(10))})) // 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/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets?limit=20"}, "limit": 20, "mount_targets": [{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "primary_ip": {"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"}, "resource_type": "share_mount_target", "subnet": {"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"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "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"}}], "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"endpoint": "Endpoint", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south", "status": "available"}`) })) }) - It(`Invoke ListShareMountTargets successfully`, func() { + It(`Invoke GetRegion successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -57324,27 +62615,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListShareMountTargets(nil) + result, response, operationErr := vpcService.GetRegion(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListShareMountTargetsOptions model - listShareMountTargetsOptionsModel := new(vpcv1.ListShareMountTargetsOptions) - listShareMountTargetsOptionsModel.ShareID = core.StringPtr("testString") - listShareMountTargetsOptionsModel.Name = core.StringPtr("testString") - listShareMountTargetsOptionsModel.Start = core.StringPtr("testString") - listShareMountTargetsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listShareMountTargetsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetRegionOptions model + getRegionOptionsModel := new(vpcv1.GetRegionOptions) + getRegionOptionsModel.Name = core.StringPtr("testString") + getRegionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListShareMountTargets(listShareMountTargetsOptionsModel) + result, response, operationErr = vpcService.GetRegion(getRegionOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListShareMountTargets with error: Operation validation and request error`, func() { + It(`Invoke GetRegion with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -57353,25 +62641,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListShareMountTargetsOptions model - listShareMountTargetsOptionsModel := new(vpcv1.ListShareMountTargetsOptions) - listShareMountTargetsOptionsModel.ShareID = core.StringPtr("testString") - listShareMountTargetsOptionsModel.Name = core.StringPtr("testString") - listShareMountTargetsOptionsModel.Start = core.StringPtr("testString") - listShareMountTargetsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listShareMountTargetsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetRegionOptions model + getRegionOptionsModel := new(vpcv1.GetRegionOptions) + getRegionOptionsModel.Name = core.StringPtr("testString") + getRegionOptionsModel.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.ListShareMountTargets(listShareMountTargetsOptionsModel) + result, response, operationErr := vpcService.GetRegion(getRegionOptionsModel) 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 ListShareMountTargetsOptions model with no property values - listShareMountTargetsOptionsModelNew := new(vpcv1.ListShareMountTargetsOptions) + // Construct a second instance of the GetRegionOptions model with no property values + getRegionOptionsModelNew := new(vpcv1.GetRegionOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListShareMountTargets(listShareMountTargetsOptionsModelNew) + result, response, operationErr = vpcService.GetRegion(getRegionOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -57389,7 +62674,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListShareMountTargets successfully`, func() { + It(`Invoke GetRegion successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -57398,16 +62683,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListShareMountTargetsOptions model - listShareMountTargetsOptionsModel := new(vpcv1.ListShareMountTargetsOptions) - listShareMountTargetsOptionsModel.ShareID = core.StringPtr("testString") - listShareMountTargetsOptionsModel.Name = core.StringPtr("testString") - listShareMountTargetsOptionsModel.Start = core.StringPtr("testString") - listShareMountTargetsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listShareMountTargetsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetRegionOptions model + getRegionOptionsModel := new(vpcv1.GetRegionOptions) + getRegionOptionsModel.Name = core.StringPtr("testString") + getRegionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListShareMountTargets(listShareMountTargetsOptionsModel) + result, response, operationErr := vpcService.GetRegion(getRegionOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -57418,131 +62700,26 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) - Context(`Test pagination helper method on response`, func() { - It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.ShareMountTargetCollection) - nextObject := new(vpcv1.ShareMountTargetCollectionNext) - 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.ShareMountTargetCollection) - - 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.ShareMountTargetCollection) - nextObject := new(vpcv1.ShareMountTargetCollectionNext) - nextObject.Href = core.StringPtr("ibm.com") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - }) - Context(`Using mock server endpoint - paginated response`, func() { - BeforeEach(func() { - var requestNumber int = 0 - 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(listShareMountTargetsPath)) - Expect(req.Method).To(Equal("GET")) - - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - requestNumber++ - if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"mount_targets":[{"access_control_mode":"security_group","created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c","id":"4cf9171a-0043-4434-8727-15b53dbc374c","lifecycle_state":"stable","mount_path":"10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e","name":"my-share-mount-target","primary_ip":{"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"},"resource_type":"share_mount_target","subnet":{"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"},"transit_encryption":"none","virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","id":"0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"},"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"}}]}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"mount_targets":[{"access_control_mode":"security_group","created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c","id":"4cf9171a-0043-4434-8727-15b53dbc374c","lifecycle_state":"stable","mount_path":"10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e","name":"my-share-mount-target","primary_ip":{"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"},"resource_type":"share_mount_target","subnet":{"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"},"transit_encryption":"none","virtual_network_interface":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","id":"0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","name":"my-virtual-network-interface","resource_type":"virtual_network_interface"},"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"}}]}`) - } else { - res.WriteHeader(400) - } - })) - }) - It(`Use ShareMountTargetsPager.GetNext 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()) - - listShareMountTargetsOptionsModel := &vpcv1.ListShareMountTargetsOptions{ - ShareID: core.StringPtr("testString"), - Name: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewShareMountTargetsPager(listShareMountTargetsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.ShareMountTarget - for pager.HasNext() { - nextPage, err := pager.GetNext() - Expect(err).To(BeNil()) - Expect(nextPage).ToNot(BeNil()) - allResults = append(allResults, nextPage...) - } - Expect(len(allResults)).To(Equal(2)) - }) - It(`Use ShareMountTargetsPager.GetAll 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()) - - listShareMountTargetsOptionsModel := &vpcv1.ListShareMountTargetsOptions{ - ShareID: core.StringPtr("testString"), - Name: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewShareMountTargetsPager(listShareMountTargetsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - allResults, err := pager.GetAll() - Expect(err).To(BeNil()) - Expect(allResults).ToNot(BeNil()) - Expect(len(allResults)).To(Equal(2)) - }) - }) }) - Describe(`CreateShareMountTarget(createShareMountTargetOptions *CreateShareMountTargetOptions) - Operation response error`, func() { + Describe(`ListRegionZones(listRegionZonesOptions *ListRegionZonesOptions) - Operation response error`, func() { version := "testString" - createShareMountTargetPath := "/shares/testString/mount_targets" + listRegionZonesPath := "/regions/testString/zones" 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(createShareMountTargetPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(listRegionZonesPath)) + 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(201) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateShareMountTarget with error: Operation response processing error`, func() { + It(`Invoke ListRegionZones with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -57551,52 +62728,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model - virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) - virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // 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 SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model - shareMountTargetVirtualNetworkInterfacePrototypeModel := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) - shareMountTargetVirtualNetworkInterfacePrototypeModel.Name = core.StringPtr("my-virtual-network-interface") - shareMountTargetVirtualNetworkInterfacePrototypeModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel - shareMountTargetVirtualNetworkInterfacePrototypeModel.ResourceGroup = resourceGroupIdentityModel - shareMountTargetVirtualNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - shareMountTargetVirtualNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - - // Construct an instance of the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model - shareMountTargetPrototypeModel := new(vpcv1.ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) - shareMountTargetPrototypeModel.Name = core.StringPtr("my-share-mount-target") - shareMountTargetPrototypeModel.TransitEncryption = core.StringPtr("none") - shareMountTargetPrototypeModel.VirtualNetworkInterface = shareMountTargetVirtualNetworkInterfacePrototypeModel - - // Construct an instance of the CreateShareMountTargetOptions model - createShareMountTargetOptionsModel := new(vpcv1.CreateShareMountTargetOptions) - createShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") - createShareMountTargetOptionsModel.ShareMountTargetPrototype = shareMountTargetPrototypeModel - createShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListRegionZonesOptions model + listRegionZonesOptionsModel := new(vpcv1.ListRegionZonesOptions) + listRegionZonesOptionsModel.RegionName = core.StringPtr("testString") + listRegionZonesOptionsModel.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.CreateShareMountTarget(createShareMountTargetOptionsModel) + result, response, operationErr := vpcService.ListRegionZones(listRegionZonesOptionsModel) 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.CreateShareMountTarget(createShareMountTargetOptionsModel) + result, response, operationErr = vpcService.ListRegionZones(listRegionZonesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -57606,33 +62750,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`CreateShareMountTarget(createShareMountTargetOptions *CreateShareMountTargetOptions)`, func() { + Describe(`ListRegionZones(listRegionZonesOptions *ListRegionZonesOptions)`, func() { version := "testString" - createShareMountTargetPath := "/shares/testString/mount_targets" + listRegionZonesPath := "/regions/testString/zones" 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(createShareMountTargetPath)) - 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.EscapedPath()).To(Equal(listRegionZonesPath)) + 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))})) @@ -57641,11 +62769,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "primary_ip": {"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"}, "resource_type": "share_mount_target", "subnet": {"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"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "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"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1", "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}, "status": "available"}]}`) })) }) - It(`Invoke CreateShareMountTarget successfully with retries`, func() { + It(`Invoke ListRegionZones successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -57655,54 +62783,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model - virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) - virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // 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 SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model - shareMountTargetVirtualNetworkInterfacePrototypeModel := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) - shareMountTargetVirtualNetworkInterfacePrototypeModel.Name = core.StringPtr("my-virtual-network-interface") - shareMountTargetVirtualNetworkInterfacePrototypeModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel - shareMountTargetVirtualNetworkInterfacePrototypeModel.ResourceGroup = resourceGroupIdentityModel - shareMountTargetVirtualNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - shareMountTargetVirtualNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - - // Construct an instance of the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model - shareMountTargetPrototypeModel := new(vpcv1.ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) - shareMountTargetPrototypeModel.Name = core.StringPtr("my-share-mount-target") - shareMountTargetPrototypeModel.TransitEncryption = core.StringPtr("none") - shareMountTargetPrototypeModel.VirtualNetworkInterface = shareMountTargetVirtualNetworkInterfacePrototypeModel - - // Construct an instance of the CreateShareMountTargetOptions model - createShareMountTargetOptionsModel := new(vpcv1.CreateShareMountTargetOptions) - createShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") - createShareMountTargetOptionsModel.ShareMountTargetPrototype = shareMountTargetPrototypeModel - createShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListRegionZonesOptions model + listRegionZonesOptionsModel := new(vpcv1.ListRegionZonesOptions) + listRegionZonesOptionsModel.RegionName = core.StringPtr("testString") + listRegionZonesOptionsModel.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.CreateShareMountTargetWithContext(ctx, createShareMountTargetOptionsModel) + _, _, operationErr := vpcService.ListRegionZonesWithContext(ctx, listRegionZonesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateShareMountTarget(createShareMountTargetOptionsModel) + result, response, operationErr := vpcService.ListRegionZones(listRegionZonesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -57710,7 +62805,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.CreateShareMountTargetWithContext(ctx, createShareMountTargetOptionsModel) + _, _, operationErr = vpcService.ListRegionZonesWithContext(ctx, listRegionZonesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -57724,34 +62819,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createShareMountTargetPath)) - 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.EscapedPath()).To(Equal(listRegionZonesPath)) + 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(201) - fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "primary_ip": {"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"}, "resource_type": "share_mount_target", "subnet": {"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"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "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"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1", "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}, "status": "available"}]}`) })) }) - It(`Invoke CreateShareMountTarget successfully`, func() { + It(`Invoke ListRegionZones successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -57761,57 +62840,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreateShareMountTarget(nil) + result, response, operationErr := vpcService.ListRegionZones(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model - virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) - virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // 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 SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model - shareMountTargetVirtualNetworkInterfacePrototypeModel := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) - shareMountTargetVirtualNetworkInterfacePrototypeModel.Name = core.StringPtr("my-virtual-network-interface") - shareMountTargetVirtualNetworkInterfacePrototypeModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel - shareMountTargetVirtualNetworkInterfacePrototypeModel.ResourceGroup = resourceGroupIdentityModel - shareMountTargetVirtualNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - shareMountTargetVirtualNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - - // Construct an instance of the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model - shareMountTargetPrototypeModel := new(vpcv1.ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) - shareMountTargetPrototypeModel.Name = core.StringPtr("my-share-mount-target") - shareMountTargetPrototypeModel.TransitEncryption = core.StringPtr("none") - shareMountTargetPrototypeModel.VirtualNetworkInterface = shareMountTargetVirtualNetworkInterfacePrototypeModel - - // Construct an instance of the CreateShareMountTargetOptions model - createShareMountTargetOptionsModel := new(vpcv1.CreateShareMountTargetOptions) - createShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") - createShareMountTargetOptionsModel.ShareMountTargetPrototype = shareMountTargetPrototypeModel - createShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListRegionZonesOptions model + listRegionZonesOptionsModel := new(vpcv1.ListRegionZonesOptions) + listRegionZonesOptionsModel.RegionName = core.StringPtr("testString") + listRegionZonesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateShareMountTarget(createShareMountTargetOptionsModel) + result, response, operationErr = vpcService.ListRegionZones(listRegionZonesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateShareMountTarget with error: Operation validation and request error`, func() { + It(`Invoke ListRegionZones with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -57820,55 +62866,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model - virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) - virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // 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 SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model - shareMountTargetVirtualNetworkInterfacePrototypeModel := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) - shareMountTargetVirtualNetworkInterfacePrototypeModel.Name = core.StringPtr("my-virtual-network-interface") - shareMountTargetVirtualNetworkInterfacePrototypeModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel - shareMountTargetVirtualNetworkInterfacePrototypeModel.ResourceGroup = resourceGroupIdentityModel - shareMountTargetVirtualNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - shareMountTargetVirtualNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - - // Construct an instance of the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model - shareMountTargetPrototypeModel := new(vpcv1.ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) - shareMountTargetPrototypeModel.Name = core.StringPtr("my-share-mount-target") - shareMountTargetPrototypeModel.TransitEncryption = core.StringPtr("none") - shareMountTargetPrototypeModel.VirtualNetworkInterface = shareMountTargetVirtualNetworkInterfacePrototypeModel - - // Construct an instance of the CreateShareMountTargetOptions model - createShareMountTargetOptionsModel := new(vpcv1.CreateShareMountTargetOptions) - createShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") - createShareMountTargetOptionsModel.ShareMountTargetPrototype = shareMountTargetPrototypeModel - createShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListRegionZonesOptions model + listRegionZonesOptionsModel := new(vpcv1.ListRegionZonesOptions) + listRegionZonesOptionsModel.RegionName = core.StringPtr("testString") + listRegionZonesOptionsModel.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.CreateShareMountTarget(createShareMountTargetOptionsModel) + result, response, operationErr := vpcService.ListRegionZones(listRegionZonesOptionsModel) 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 CreateShareMountTargetOptions model with no property values - createShareMountTargetOptionsModelNew := new(vpcv1.CreateShareMountTargetOptions) + // Construct a second instance of the ListRegionZonesOptions model with no property values + listRegionZonesOptionsModelNew := new(vpcv1.ListRegionZonesOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateShareMountTarget(createShareMountTargetOptionsModelNew) + result, response, operationErr = vpcService.ListRegionZones(listRegionZonesOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -57883,10 +62896,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke CreateShareMountTarget successfully`, func() { + It(`Invoke ListRegionZones successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -57895,46 +62908,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model - virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) - virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) - virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - - // 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 SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model - shareMountTargetVirtualNetworkInterfacePrototypeModel := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) - shareMountTargetVirtualNetworkInterfacePrototypeModel.Name = core.StringPtr("my-virtual-network-interface") - shareMountTargetVirtualNetworkInterfacePrototypeModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel - shareMountTargetVirtualNetworkInterfacePrototypeModel.ResourceGroup = resourceGroupIdentityModel - shareMountTargetVirtualNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - shareMountTargetVirtualNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - - // Construct an instance of the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup model - shareMountTargetPrototypeModel := new(vpcv1.ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) - shareMountTargetPrototypeModel.Name = core.StringPtr("my-share-mount-target") - shareMountTargetPrototypeModel.TransitEncryption = core.StringPtr("none") - shareMountTargetPrototypeModel.VirtualNetworkInterface = shareMountTargetVirtualNetworkInterfacePrototypeModel - - // Construct an instance of the CreateShareMountTargetOptions model - createShareMountTargetOptionsModel := new(vpcv1.CreateShareMountTargetOptions) - createShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") - createShareMountTargetOptionsModel.ShareMountTargetPrototype = shareMountTargetPrototypeModel - createShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListRegionZonesOptions model + listRegionZonesOptionsModel := new(vpcv1.ListRegionZonesOptions) + listRegionZonesOptionsModel.RegionName = core.StringPtr("testString") + listRegionZonesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.CreateShareMountTarget(createShareMountTargetOptionsModel) + result, response, operationErr := vpcService.ListRegionZones(listRegionZonesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -57946,25 +62926,25 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteShareMountTarget(deleteShareMountTargetOptions *DeleteShareMountTargetOptions) - Operation response error`, func() { + Describe(`GetRegionZone(getRegionZoneOptions *GetRegionZoneOptions) - Operation response error`, func() { version := "testString" - deleteShareMountTargetPath := "/shares/testString/mount_targets/testString" + getRegionZonePath := "/regions/testString/zones/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(deleteShareMountTargetPath)) - Expect(req.Method).To(Equal("DELETE")) + Expect(req.URL.EscapedPath()).To(Equal(getRegionZonePath)) + 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(202) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke DeleteShareMountTarget with error: Operation response processing error`, func() { + It(`Invoke GetRegionZone with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -57973,20 +62953,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteShareMountTargetOptions model - deleteShareMountTargetOptionsModel := new(vpcv1.DeleteShareMountTargetOptions) - deleteShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") - deleteShareMountTargetOptionsModel.ID = core.StringPtr("testString") - deleteShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetRegionZoneOptions model + getRegionZoneOptionsModel := new(vpcv1.GetRegionZoneOptions) + getRegionZoneOptionsModel.RegionName = core.StringPtr("testString") + getRegionZoneOptionsModel.Name = core.StringPtr("testString") + getRegionZoneOptionsModel.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.DeleteShareMountTarget(deleteShareMountTargetOptionsModel) + result, response, operationErr := vpcService.GetRegionZone(getRegionZoneOptionsModel) 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.DeleteShareMountTarget(deleteShareMountTargetOptionsModel) + result, response, operationErr = vpcService.GetRegionZone(getRegionZoneOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -57996,17 +62976,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteShareMountTarget(deleteShareMountTargetOptions *DeleteShareMountTargetOptions)`, func() { + Describe(`GetRegionZone(getRegionZoneOptions *GetRegionZoneOptions)`, func() { version := "testString" - deleteShareMountTargetPath := "/shares/testString/mount_targets/testString" + getRegionZonePath := "/regions/testString/zones/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(deleteShareMountTargetPath)) - Expect(req.Method).To(Equal("DELETE")) + Expect(req.URL.EscapedPath()).To(Equal(getRegionZonePath)) + 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))})) @@ -58015,11 +62995,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) - fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "primary_ip": {"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"}, "resource_type": "share_mount_target", "subnet": {"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"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "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"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1", "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}, "status": "available"}`) })) }) - It(`Invoke DeleteShareMountTarget successfully with retries`, func() { + It(`Invoke GetRegionZone successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -58029,22 +63009,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the DeleteShareMountTargetOptions model - deleteShareMountTargetOptionsModel := new(vpcv1.DeleteShareMountTargetOptions) - deleteShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") - deleteShareMountTargetOptionsModel.ID = core.StringPtr("testString") - deleteShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetRegionZoneOptions model + getRegionZoneOptionsModel := new(vpcv1.GetRegionZoneOptions) + getRegionZoneOptionsModel.RegionName = core.StringPtr("testString") + getRegionZoneOptionsModel.Name = core.StringPtr("testString") + getRegionZoneOptionsModel.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.DeleteShareMountTargetWithContext(ctx, deleteShareMountTargetOptionsModel) + _, _, operationErr := vpcService.GetRegionZoneWithContext(ctx, getRegionZoneOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.DeleteShareMountTarget(deleteShareMountTargetOptionsModel) + result, response, operationErr := vpcService.GetRegionZone(getRegionZoneOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -58052,7 +63032,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.DeleteShareMountTargetWithContext(ctx, deleteShareMountTargetOptionsModel) + _, _, operationErr = vpcService.GetRegionZoneWithContext(ctx, getRegionZoneOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -58066,18 +63046,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteShareMountTargetPath)) - Expect(req.Method).To(Equal("DELETE")) + Expect(req.URL.EscapedPath()).To(Equal(getRegionZonePath)) + 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(202) - fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "primary_ip": {"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"}, "resource_type": "share_mount_target", "subnet": {"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"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "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"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1", "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}, "status": "available"}`) })) }) - It(`Invoke DeleteShareMountTarget successfully`, func() { + It(`Invoke GetRegionZone successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -58087,25 +63067,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.DeleteShareMountTarget(nil) + result, response, operationErr := vpcService.GetRegionZone(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the DeleteShareMountTargetOptions model - deleteShareMountTargetOptionsModel := new(vpcv1.DeleteShareMountTargetOptions) - deleteShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") - deleteShareMountTargetOptionsModel.ID = core.StringPtr("testString") - deleteShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetRegionZoneOptions model + getRegionZoneOptionsModel := new(vpcv1.GetRegionZoneOptions) + getRegionZoneOptionsModel.RegionName = core.StringPtr("testString") + getRegionZoneOptionsModel.Name = core.StringPtr("testString") + getRegionZoneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.DeleteShareMountTarget(deleteShareMountTargetOptionsModel) + result, response, operationErr = vpcService.GetRegionZone(getRegionZoneOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke DeleteShareMountTarget with error: Operation validation and request error`, func() { + It(`Invoke GetRegionZone with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -58114,23 +63094,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteShareMountTargetOptions model - deleteShareMountTargetOptionsModel := new(vpcv1.DeleteShareMountTargetOptions) - deleteShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") - deleteShareMountTargetOptionsModel.ID = core.StringPtr("testString") - deleteShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetRegionZoneOptions model + getRegionZoneOptionsModel := new(vpcv1.GetRegionZoneOptions) + getRegionZoneOptionsModel.RegionName = core.StringPtr("testString") + getRegionZoneOptionsModel.Name = core.StringPtr("testString") + getRegionZoneOptionsModel.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.DeleteShareMountTarget(deleteShareMountTargetOptionsModel) + result, response, operationErr := vpcService.GetRegionZone(getRegionZoneOptionsModel) 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 DeleteShareMountTargetOptions model with no property values - deleteShareMountTargetOptionsModelNew := new(vpcv1.DeleteShareMountTargetOptions) + // Construct a second instance of the GetRegionZoneOptions model with no property values + getRegionZoneOptionsModelNew := new(vpcv1.GetRegionZoneOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.DeleteShareMountTarget(deleteShareMountTargetOptionsModelNew) + result, response, operationErr = vpcService.GetRegionZone(getRegionZoneOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -58145,10 +63125,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(202) + res.WriteHeader(200) })) }) - It(`Invoke DeleteShareMountTarget successfully`, func() { + It(`Invoke GetRegionZone successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -58157,14 +63137,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the DeleteShareMountTargetOptions model - deleteShareMountTargetOptionsModel := new(vpcv1.DeleteShareMountTargetOptions) - deleteShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") - deleteShareMountTargetOptionsModel.ID = core.StringPtr("testString") - deleteShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetRegionZoneOptions model + getRegionZoneOptionsModel := new(vpcv1.GetRegionZoneOptions) + getRegionZoneOptionsModel.RegionName = core.StringPtr("testString") + getRegionZoneOptionsModel.Name = core.StringPtr("testString") + getRegionZoneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.DeleteShareMountTarget(deleteShareMountTargetOptionsModel) + result, response, operationErr := vpcService.GetRegionZone(getRegionZoneOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -58176,25 +63156,28 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetShareMountTarget(getShareMountTargetOptions *GetShareMountTargetOptions) - Operation response error`, func() { + Describe(`ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptions *ListVirtualNetworkInterfacesOptions) - Operation response error`, func() { version := "testString" - getShareMountTargetPath := "/shares/testString/mount_targets/testString" + listVirtualNetworkInterfacesPath := "/virtual_network_interfaces" 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(getShareMountTargetPath)) + Expect(req.URL.EscapedPath()).To(Equal(listVirtualNetworkInterfacesPath)) 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(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetShareMountTarget with error: Operation response processing error`, func() { + It(`Invoke ListVirtualNetworkInterfaces with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -58203,20 +63186,21 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetShareMountTargetOptions model - getShareMountTargetOptionsModel := new(vpcv1.GetShareMountTargetOptions) - getShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") - getShareMountTargetOptionsModel.ID = core.StringPtr("testString") - getShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListVirtualNetworkInterfacesOptions model + listVirtualNetworkInterfacesOptionsModel := new(vpcv1.ListVirtualNetworkInterfacesOptions) + listVirtualNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") + listVirtualNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listVirtualNetworkInterfacesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listVirtualNetworkInterfacesOptionsModel.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.GetShareMountTarget(getShareMountTargetOptionsModel) + result, response, operationErr := vpcService.ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptionsModel) 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.GetShareMountTarget(getShareMountTargetOptionsModel) + result, response, operationErr = vpcService.ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -58226,30 +63210,33 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetShareMountTarget(getShareMountTargetOptions *GetShareMountTargetOptions)`, func() { + Describe(`ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptions *ListVirtualNetworkInterfacesOptions)`, func() { version := "testString" - getShareMountTargetPath := "/shares/testString/mount_targets/testString" + listVirtualNetworkInterfacesPath := "/virtual_network_interfaces" 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(getShareMountTargetPath)) + Expect(req.URL.EscapedPath()).To(Equal(listVirtualNetworkInterfacesPath)) 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(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) // 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", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "primary_ip": {"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"}, "resource_type": "share_mount_target", "subnet": {"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"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "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", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces?start=d3e721fd-c988-4670-9927-dbd5e7b07fc6&limit=20"}, "total_count": 132, "virtual_network_interfaces": [{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "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"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-network-interface", "primary_ip": {"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"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "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"}], "subnet": {"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"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "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"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}]}`) })) }) - It(`Invoke GetShareMountTarget successfully with retries`, func() { + It(`Invoke ListVirtualNetworkInterfaces successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -58259,22 +63246,23 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetShareMountTargetOptions model - getShareMountTargetOptionsModel := new(vpcv1.GetShareMountTargetOptions) - getShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") - getShareMountTargetOptionsModel.ID = core.StringPtr("testString") - getShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListVirtualNetworkInterfacesOptions model + listVirtualNetworkInterfacesOptionsModel := new(vpcv1.ListVirtualNetworkInterfacesOptions) + listVirtualNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") + listVirtualNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listVirtualNetworkInterfacesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listVirtualNetworkInterfacesOptionsModel.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.GetShareMountTargetWithContext(ctx, getShareMountTargetOptionsModel) + _, _, operationErr := vpcService.ListVirtualNetworkInterfacesWithContext(ctx, listVirtualNetworkInterfacesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetShareMountTarget(getShareMountTargetOptionsModel) + result, response, operationErr := vpcService.ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -58282,7 +63270,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetShareMountTargetWithContext(ctx, getShareMountTargetOptionsModel) + _, _, operationErr = vpcService.ListVirtualNetworkInterfacesWithContext(ctx, listVirtualNetworkInterfacesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -58296,18 +63284,21 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getShareMountTargetPath)) + Expect(req.URL.EscapedPath()).To(Equal(listVirtualNetworkInterfacesPath)) 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(10))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "primary_ip": {"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"}, "resource_type": "share_mount_target", "subnet": {"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"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "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", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces?start=d3e721fd-c988-4670-9927-dbd5e7b07fc6&limit=20"}, "total_count": 132, "virtual_network_interfaces": [{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "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"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-network-interface", "primary_ip": {"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"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "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"}], "subnet": {"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"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "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"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}]}`) })) }) - It(`Invoke GetShareMountTarget successfully`, func() { + It(`Invoke ListVirtualNetworkInterfaces successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -58317,25 +63308,26 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetShareMountTarget(nil) + result, response, operationErr := vpcService.ListVirtualNetworkInterfaces(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetShareMountTargetOptions model - getShareMountTargetOptionsModel := new(vpcv1.GetShareMountTargetOptions) - getShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") - getShareMountTargetOptionsModel.ID = core.StringPtr("testString") - getShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListVirtualNetworkInterfacesOptions model + listVirtualNetworkInterfacesOptionsModel := new(vpcv1.ListVirtualNetworkInterfacesOptions) + listVirtualNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") + listVirtualNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listVirtualNetworkInterfacesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listVirtualNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetShareMountTarget(getShareMountTargetOptionsModel) + result, response, operationErr = vpcService.ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetShareMountTarget with error: Operation validation and request error`, func() { + It(`Invoke ListVirtualNetworkInterfaces with error: Operation request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -58344,26 +63336,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetShareMountTargetOptions model - getShareMountTargetOptionsModel := new(vpcv1.GetShareMountTargetOptions) - getShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") - getShareMountTargetOptionsModel.ID = core.StringPtr("testString") - getShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListVirtualNetworkInterfacesOptions model + listVirtualNetworkInterfacesOptionsModel := new(vpcv1.ListVirtualNetworkInterfacesOptions) + listVirtualNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") + listVirtualNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listVirtualNetworkInterfacesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listVirtualNetworkInterfacesOptionsModel.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.GetShareMountTarget(getShareMountTargetOptionsModel) + result, response, operationErr := vpcService.ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptionsModel) 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 GetShareMountTargetOptions model with no property values - getShareMountTargetOptionsModelNew := new(vpcv1.GetShareMountTargetOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetShareMountTarget(getShareMountTargetOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -58378,7 +63364,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetShareMountTarget successfully`, func() { + It(`Invoke ListVirtualNetworkInterfaces successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -58387,14 +63373,15 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetShareMountTargetOptions model - getShareMountTargetOptionsModel := new(vpcv1.GetShareMountTargetOptions) - getShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") - getShareMountTargetOptionsModel.ID = core.StringPtr("testString") - getShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListVirtualNetworkInterfacesOptions model + listVirtualNetworkInterfacesOptionsModel := new(vpcv1.ListVirtualNetworkInterfacesOptions) + listVirtualNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") + listVirtualNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) + listVirtualNetworkInterfacesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listVirtualNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetShareMountTarget(getShareMountTargetOptionsModel) + result, response, operationErr := vpcService.ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -58405,26 +63392,129 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(vpcv1.VirtualNetworkInterfaceCollection) + nextObject := new(vpcv1.VirtualNetworkInterfaceCollectionNext) + 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.VirtualNetworkInterfaceCollection) + + 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.VirtualNetworkInterfaceCollection) + nextObject := new(vpcv1.VirtualNetworkInterfaceCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { + BeforeEach(func() { + var requestNumber int = 0 + 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(listVirtualNetworkInterfacesPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"virtual_network_interfaces":[{"allow_ip_spoofing":true,"auto_delete":false,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","enable_infrastructure_nat":true,"href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","id":"0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","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"}],"lifecycle_state":"stable","mac_address":"02:00:4D:45:45:4D","name":"my-virtual-network-interface","primary_ip":{"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"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"virtual_network_interface","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"}],"subnet":{"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"},"target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c","id":"4cf9171a-0043-4434-8727-15b53dbc374c","name":"my-share-mount-target","resource_type":"share_mount_target"},"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"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"virtual_network_interfaces":[{"allow_ip_spoofing":true,"auto_delete":false,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","enable_infrastructure_nat":true,"href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","id":"0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","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"}],"lifecycle_state":"stable","mac_address":"02:00:4D:45:45:4D","name":"my-virtual-network-interface","primary_ip":{"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"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"virtual_network_interface","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"}],"subnet":{"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"},"target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c","id":"4cf9171a-0043-4434-8727-15b53dbc374c","name":"my-share-mount-target","resource_type":"share_mount_target"},"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"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use VirtualNetworkInterfacesPager.GetNext 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()) + + listVirtualNetworkInterfacesOptionsModel := &vpcv1.ListVirtualNetworkInterfacesOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + } + + pager, err := vpcService.NewVirtualNetworkInterfacesPager(listVirtualNetworkInterfacesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.VirtualNetworkInterface + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) + }) + It(`Use VirtualNetworkInterfacesPager.GetAll 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()) + + listVirtualNetworkInterfacesOptionsModel := &vpcv1.ListVirtualNetworkInterfacesOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + } + + pager, err := vpcService.NewVirtualNetworkInterfacesPager(listVirtualNetworkInterfacesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) + }) + }) }) - Describe(`UpdateShareMountTarget(updateShareMountTargetOptions *UpdateShareMountTargetOptions) - Operation response error`, func() { + Describe(`CreateVirtualNetworkInterface(createVirtualNetworkInterfaceOptions *CreateVirtualNetworkInterfaceOptions) - Operation response error`, func() { version := "testString" - updateShareMountTargetPath := "/shares/testString/mount_targets/testString" + createVirtualNetworkInterfacePath := "/virtual_network_interfaces" 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(updateShareMountTargetPath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(createVirtualNetworkInterfacePath)) + 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(200) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateShareMountTarget with error: Operation response processing error`, func() { + It(`Invoke CreateVirtualNetworkInterface with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -58433,27 +63523,51 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ShareMountTargetPatch model - shareMountTargetPatchModel := new(vpcv1.ShareMountTargetPatch) - shareMountTargetPatchModel.Name = core.StringPtr("my-share-mount-target") - shareMountTargetPatchModelAsPatch, asPatchErr := shareMountTargetPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - // Construct an instance of the UpdateShareMountTargetOptions model - updateShareMountTargetOptionsModel := new(vpcv1.UpdateShareMountTargetOptions) - updateShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") - updateShareMountTargetOptionsModel.ID = core.StringPtr("testString") - updateShareMountTargetOptionsModel.ShareMountTargetPatch = shareMountTargetPatchModelAsPatch - updateShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // 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 SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the CreateVirtualNetworkInterfaceOptions model + createVirtualNetworkInterfaceOptionsModel := new(vpcv1.CreateVirtualNetworkInterfaceOptions) + createVirtualNetworkInterfaceOptionsModel.AllowIPSpoofing = core.BoolPtr(true) + createVirtualNetworkInterfaceOptionsModel.AutoDelete = core.BoolPtr(false) + createVirtualNetworkInterfaceOptionsModel.EnableInfrastructureNat = core.BoolPtr(true) + createVirtualNetworkInterfaceOptionsModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + createVirtualNetworkInterfaceOptionsModel.Name = core.StringPtr("my-virtual-network-interface") + createVirtualNetworkInterfaceOptionsModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + createVirtualNetworkInterfaceOptionsModel.ResourceGroup = resourceGroupIdentityModel + createVirtualNetworkInterfaceOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + createVirtualNetworkInterfaceOptionsModel.Subnet = subnetIdentityModel + createVirtualNetworkInterfaceOptionsModel.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.UpdateShareMountTarget(updateShareMountTargetOptionsModel) + result, response, operationErr := vpcService.CreateVirtualNetworkInterface(createVirtualNetworkInterfaceOptionsModel) 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.UpdateShareMountTarget(updateShareMountTargetOptionsModel) + result, response, operationErr = vpcService.CreateVirtualNetworkInterface(createVirtualNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -58463,17 +63577,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateShareMountTarget(updateShareMountTargetOptions *UpdateShareMountTargetOptions)`, func() { + Describe(`CreateVirtualNetworkInterface(createVirtualNetworkInterfaceOptions *CreateVirtualNetworkInterfaceOptions)`, func() { version := "testString" - updateShareMountTargetPath := "/shares/testString/mount_targets/testString" + createVirtualNetworkInterfacePath := "/virtual_network_interfaces" 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(updateShareMountTargetPath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(createVirtualNetworkInterfacePath)) + Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -58498,11 +63612,11 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "primary_ip": {"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"}, "resource_type": "share_mount_target", "subnet": {"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"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "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"}}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "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"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-network-interface", "primary_ip": {"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"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "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"}], "subnet": {"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"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "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"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke UpdateShareMountTarget successfully with retries`, func() { + It(`Invoke CreateVirtualNetworkInterface successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -58512,29 +63626,53 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ShareMountTargetPatch model - shareMountTargetPatchModel := new(vpcv1.ShareMountTargetPatch) - shareMountTargetPatchModel.Name = core.StringPtr("my-share-mount-target") - shareMountTargetPatchModelAsPatch, asPatchErr := shareMountTargetPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - // Construct an instance of the UpdateShareMountTargetOptions model - updateShareMountTargetOptionsModel := new(vpcv1.UpdateShareMountTargetOptions) - updateShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") - updateShareMountTargetOptionsModel.ID = core.StringPtr("testString") - updateShareMountTargetOptionsModel.ShareMountTargetPatch = shareMountTargetPatchModelAsPatch - updateShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // 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 SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the CreateVirtualNetworkInterfaceOptions model + createVirtualNetworkInterfaceOptionsModel := new(vpcv1.CreateVirtualNetworkInterfaceOptions) + createVirtualNetworkInterfaceOptionsModel.AllowIPSpoofing = core.BoolPtr(true) + createVirtualNetworkInterfaceOptionsModel.AutoDelete = core.BoolPtr(false) + createVirtualNetworkInterfaceOptionsModel.EnableInfrastructureNat = core.BoolPtr(true) + createVirtualNetworkInterfaceOptionsModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + createVirtualNetworkInterfaceOptionsModel.Name = core.StringPtr("my-virtual-network-interface") + createVirtualNetworkInterfaceOptionsModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + createVirtualNetworkInterfaceOptionsModel.ResourceGroup = resourceGroupIdentityModel + createVirtualNetworkInterfaceOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + createVirtualNetworkInterfaceOptionsModel.Subnet = subnetIdentityModel + createVirtualNetworkInterfaceOptionsModel.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.UpdateShareMountTargetWithContext(ctx, updateShareMountTargetOptionsModel) + _, _, operationErr := vpcService.CreateVirtualNetworkInterfaceWithContext(ctx, createVirtualNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateShareMountTarget(updateShareMountTargetOptionsModel) + result, response, operationErr := vpcService.CreateVirtualNetworkInterface(createVirtualNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -58542,7 +63680,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateShareMountTargetWithContext(ctx, updateShareMountTargetOptionsModel) + _, _, operationErr = vpcService.CreateVirtualNetworkInterfaceWithContext(ctx, createVirtualNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -58556,8 +63694,8 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateShareMountTargetPath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(createVirtualNetworkInterfacePath)) + Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -58579,11 +63717,11 @@ var _ = Describe(`VpcV1`, func() { 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", `{"access_control_mode": "security_group", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "lifecycle_state": "stable", "mount_path": "10.240.1.23:/nxg_s_voll_mz7121_58e7e963_8f4b_4a0c_b71a_8ba8d9cd1e2e", "name": "my-share-mount-target", "primary_ip": {"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"}, "resource_type": "share_mount_target", "subnet": {"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"}, "transit_encryption": "none", "virtual_network_interface": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "name": "my-virtual-network-interface", "resource_type": "virtual_network_interface"}, "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"}}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "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"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-network-interface", "primary_ip": {"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"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "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"}], "subnet": {"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"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "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"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke UpdateShareMountTarget successfully`, func() { + It(`Invoke CreateVirtualNetworkInterface successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -58593,32 +63731,56 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateShareMountTarget(nil) + result, response, operationErr := vpcService.CreateVirtualNetworkInterface(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ShareMountTargetPatch model - shareMountTargetPatchModel := new(vpcv1.ShareMountTargetPatch) - shareMountTargetPatchModel.Name = core.StringPtr("my-share-mount-target") - shareMountTargetPatchModelAsPatch, asPatchErr := shareMountTargetPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - // Construct an instance of the UpdateShareMountTargetOptions model - updateShareMountTargetOptionsModel := new(vpcv1.UpdateShareMountTargetOptions) - updateShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") - updateShareMountTargetOptionsModel.ID = core.StringPtr("testString") - updateShareMountTargetOptionsModel.ShareMountTargetPatch = shareMountTargetPatchModelAsPatch - updateShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // 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 SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the CreateVirtualNetworkInterfaceOptions model + createVirtualNetworkInterfaceOptionsModel := new(vpcv1.CreateVirtualNetworkInterfaceOptions) + createVirtualNetworkInterfaceOptionsModel.AllowIPSpoofing = core.BoolPtr(true) + createVirtualNetworkInterfaceOptionsModel.AutoDelete = core.BoolPtr(false) + createVirtualNetworkInterfaceOptionsModel.EnableInfrastructureNat = core.BoolPtr(true) + createVirtualNetworkInterfaceOptionsModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + createVirtualNetworkInterfaceOptionsModel.Name = core.StringPtr("my-virtual-network-interface") + createVirtualNetworkInterfaceOptionsModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + createVirtualNetworkInterfaceOptionsModel.ResourceGroup = resourceGroupIdentityModel + createVirtualNetworkInterfaceOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + createVirtualNetworkInterfaceOptionsModel.Subnet = subnetIdentityModel + createVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateShareMountTarget(updateShareMountTargetOptionsModel) + result, response, operationErr = vpcService.CreateVirtualNetworkInterface(createVirtualNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateShareMountTarget with error: Operation validation and request error`, func() { + It(`Invoke CreateVirtualNetworkInterface with error: Operation request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -58627,33 +63789,50 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ShareMountTargetPatch model - shareMountTargetPatchModel := new(vpcv1.ShareMountTargetPatch) - shareMountTargetPatchModel.Name = core.StringPtr("my-share-mount-target") - shareMountTargetPatchModelAsPatch, asPatchErr := shareMountTargetPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - // Construct an instance of the UpdateShareMountTargetOptions model - updateShareMountTargetOptionsModel := new(vpcv1.UpdateShareMountTargetOptions) - updateShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") - updateShareMountTargetOptionsModel.ID = core.StringPtr("testString") - updateShareMountTargetOptionsModel.ShareMountTargetPatch = shareMountTargetPatchModelAsPatch - updateShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // 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 SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the CreateVirtualNetworkInterfaceOptions model + createVirtualNetworkInterfaceOptionsModel := new(vpcv1.CreateVirtualNetworkInterfaceOptions) + createVirtualNetworkInterfaceOptionsModel.AllowIPSpoofing = core.BoolPtr(true) + createVirtualNetworkInterfaceOptionsModel.AutoDelete = core.BoolPtr(false) + createVirtualNetworkInterfaceOptionsModel.EnableInfrastructureNat = core.BoolPtr(true) + createVirtualNetworkInterfaceOptionsModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + createVirtualNetworkInterfaceOptionsModel.Name = core.StringPtr("my-virtual-network-interface") + createVirtualNetworkInterfaceOptionsModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + createVirtualNetworkInterfaceOptionsModel.ResourceGroup = resourceGroupIdentityModel + createVirtualNetworkInterfaceOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + createVirtualNetworkInterfaceOptionsModel.Subnet = subnetIdentityModel + createVirtualNetworkInterfaceOptionsModel.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.UpdateShareMountTarget(updateShareMountTargetOptionsModel) + result, response, operationErr := vpcService.CreateVirtualNetworkInterface(createVirtualNetworkInterfaceOptionsModel) 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 UpdateShareMountTargetOptions model with no property values - updateShareMountTargetOptionsModelNew := new(vpcv1.UpdateShareMountTargetOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateShareMountTarget(updateShareMountTargetOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -58665,10 +63844,10 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke UpdateShareMountTarget successfully`, func() { + It(`Invoke CreateVirtualNetworkInterface successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -58677,21 +63856,45 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ShareMountTargetPatch model - shareMountTargetPatchModel := new(vpcv1.ShareMountTargetPatch) - shareMountTargetPatchModel.Name = core.StringPtr("my-share-mount-target") - shareMountTargetPatchModelAsPatch, asPatchErr := shareMountTargetPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - // Construct an instance of the UpdateShareMountTargetOptions model - updateShareMountTargetOptionsModel := new(vpcv1.UpdateShareMountTargetOptions) - updateShareMountTargetOptionsModel.ShareID = core.StringPtr("testString") - updateShareMountTargetOptionsModel.ID = core.StringPtr("testString") - updateShareMountTargetOptionsModel.ShareMountTargetPatch = shareMountTargetPatchModelAsPatch - updateShareMountTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + + // 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 SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the CreateVirtualNetworkInterfaceOptions model + createVirtualNetworkInterfaceOptionsModel := new(vpcv1.CreateVirtualNetworkInterfaceOptions) + createVirtualNetworkInterfaceOptionsModel.AllowIPSpoofing = core.BoolPtr(true) + createVirtualNetworkInterfaceOptionsModel.AutoDelete = core.BoolPtr(false) + createVirtualNetworkInterfaceOptionsModel.EnableInfrastructureNat = core.BoolPtr(true) + createVirtualNetworkInterfaceOptionsModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + createVirtualNetworkInterfaceOptionsModel.Name = core.StringPtr("my-virtual-network-interface") + createVirtualNetworkInterfaceOptionsModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + createVirtualNetworkInterfaceOptionsModel.ResourceGroup = resourceGroupIdentityModel + createVirtualNetworkInterfaceOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + createVirtualNetworkInterfaceOptionsModel.Subnet = subnetIdentityModel + createVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.UpdateShareMountTarget(updateShareMountTargetOptionsModel) + result, response, operationErr := vpcService.CreateVirtualNetworkInterface(createVirtualNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -58703,16 +63906,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`DeleteShareSource(deleteShareSourceOptions *DeleteShareSourceOptions)`, func() { + Describe(`DeleteVirtualNetworkInterfaces(deleteVirtualNetworkInterfacesOptions *DeleteVirtualNetworkInterfacesOptions)`, func() { version := "testString" - deleteShareSourcePath := "/shares/testString/source" + deleteVirtualNetworkInterfacesPath := "/virtual_network_interfaces/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(deleteShareSourcePath)) + Expect(req.URL.EscapedPath()).To(Equal(deleteVirtualNetworkInterfacesPath)) Expect(req.Method).To(Equal("DELETE")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -58720,7 +63923,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(202) })) }) - It(`Invoke DeleteShareSource successfully`, func() { + It(`Invoke DeleteVirtualNetworkInterfaces successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -58730,44 +63933,44 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - response, operationErr := vpcService.DeleteShareSource(nil) + response, operationErr := vpcService.DeleteVirtualNetworkInterfaces(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) - // Construct an instance of the DeleteShareSourceOptions model - deleteShareSourceOptionsModel := new(vpcv1.DeleteShareSourceOptions) - deleteShareSourceOptionsModel.ShareID = core.StringPtr("testString") - deleteShareSourceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteVirtualNetworkInterfacesOptions model + deleteVirtualNetworkInterfacesOptionsModel := new(vpcv1.DeleteVirtualNetworkInterfacesOptions) + deleteVirtualNetworkInterfacesOptionsModel.ID = core.StringPtr("testString") + deleteVirtualNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteShareSource(deleteShareSourceOptionsModel) + response, operationErr = vpcService.DeleteVirtualNetworkInterfaces(deleteVirtualNetworkInterfacesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) }) - It(`Invoke DeleteShareSource with error: Operation validation and request error`, func() { + It(`Invoke DeleteVirtualNetworkInterfaces 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 DeleteShareSourceOptions model - deleteShareSourceOptionsModel := new(vpcv1.DeleteShareSourceOptions) - deleteShareSourceOptionsModel.ShareID = core.StringPtr("testString") - deleteShareSourceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the DeleteVirtualNetworkInterfacesOptions model + deleteVirtualNetworkInterfacesOptionsModel := new(vpcv1.DeleteVirtualNetworkInterfacesOptions) + deleteVirtualNetworkInterfacesOptionsModel.ID = core.StringPtr("testString") + deleteVirtualNetworkInterfacesOptionsModel.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.DeleteShareSource(deleteShareSourceOptionsModel) + response, operationErr := vpcService.DeleteVirtualNetworkInterfaces(deleteVirtualNetworkInterfacesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - // Construct a second instance of the DeleteShareSourceOptions model with no property values - deleteShareSourceOptionsModelNew := new(vpcv1.DeleteShareSourceOptions) + // Construct a second instance of the DeleteVirtualNetworkInterfacesOptions model with no property values + deleteVirtualNetworkInterfacesOptionsModelNew := new(vpcv1.DeleteVirtualNetworkInterfacesOptions) // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteShareSource(deleteShareSourceOptionsModelNew) + response, operationErr = vpcService.DeleteVirtualNetworkInterfaces(deleteVirtualNetworkInterfacesOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) }) @@ -58776,16 +63979,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetShareSource(getShareSourceOptions *GetShareSourceOptions) - Operation response error`, func() { + Describe(`GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptions *GetVirtualNetworkInterfaceOptions) - Operation response error`, func() { version := "testString" - getShareSourcePath := "/shares/testString/source" + getVirtualNetworkInterfacePath := "/virtual_network_interfaces/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(getShareSourcePath)) + Expect(req.URL.EscapedPath()).To(Equal(getVirtualNetworkInterfacePath)) 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))})) @@ -58794,7 +63997,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetShareSource with error: Operation response processing error`, func() { + It(`Invoke GetVirtualNetworkInterface with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -58803,19 +64006,19 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetShareSourceOptions model - getShareSourceOptionsModel := new(vpcv1.GetShareSourceOptions) - getShareSourceOptionsModel.ShareID = core.StringPtr("testString") - getShareSourceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetVirtualNetworkInterfaceOptions model + getVirtualNetworkInterfaceOptionsModel := new(vpcv1.GetVirtualNetworkInterfaceOptions) + getVirtualNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + getVirtualNetworkInterfaceOptionsModel.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.GetShareSource(getShareSourceOptionsModel) + result, response, operationErr := vpcService.GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptionsModel) 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.GetShareSource(getShareSourceOptionsModel) + result, response, operationErr = vpcService.GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -58825,16 +64028,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetShareSource(getShareSourceOptions *GetShareSourceOptions)`, func() { + Describe(`GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptions *GetVirtualNetworkInterfaceOptions)`, func() { version := "testString" - getShareSourcePath := "/shares/testString/source" + getVirtualNetworkInterfacePath := "/virtual_network_interfaces/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(getShareSourcePath)) + Expect(req.URL.EscapedPath()).To(Equal(getVirtualNetworkInterfacePath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -58845,10 +64048,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}`) + fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "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"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-network-interface", "primary_ip": {"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"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "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"}], "subnet": {"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"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "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"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke GetShareSource successfully with retries`, func() { + It(`Invoke GetVirtualNetworkInterface successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -58858,21 +64061,21 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetShareSourceOptions model - getShareSourceOptionsModel := new(vpcv1.GetShareSourceOptions) - getShareSourceOptionsModel.ShareID = core.StringPtr("testString") - getShareSourceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetVirtualNetworkInterfaceOptions model + getVirtualNetworkInterfaceOptionsModel := new(vpcv1.GetVirtualNetworkInterfaceOptions) + getVirtualNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + getVirtualNetworkInterfaceOptionsModel.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.GetShareSourceWithContext(ctx, getShareSourceOptionsModel) + _, _, operationErr := vpcService.GetVirtualNetworkInterfaceWithContext(ctx, getVirtualNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetShareSource(getShareSourceOptionsModel) + result, response, operationErr := vpcService.GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -58880,7 +64083,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetShareSourceWithContext(ctx, getShareSourceOptionsModel) + _, _, operationErr = vpcService.GetVirtualNetworkInterfaceWithContext(ctx, getVirtualNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -58894,7 +64097,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getShareSourcePath)) + Expect(req.URL.EscapedPath()).To(Equal(getVirtualNetworkInterfacePath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -58902,10 +64105,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::share:0fe9e5d8-0a4d-4818-96ec-e99708644a58", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58", "id": "0fe9e5d8-0a4d-4818-96ec-e99708644a58", "name": "my-share", "remote": {"region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}}, "resource_type": "share"}`) + fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "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"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-network-interface", "primary_ip": {"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"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "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"}], "subnet": {"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"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "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"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke GetShareSource successfully`, func() { + It(`Invoke GetVirtualNetworkInterface successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -58915,24 +64118,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetShareSource(nil) + result, response, operationErr := vpcService.GetVirtualNetworkInterface(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetShareSourceOptions model - getShareSourceOptionsModel := new(vpcv1.GetShareSourceOptions) - getShareSourceOptionsModel.ShareID = core.StringPtr("testString") - getShareSourceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetVirtualNetworkInterfaceOptions model + getVirtualNetworkInterfaceOptionsModel := new(vpcv1.GetVirtualNetworkInterfaceOptions) + getVirtualNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + getVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetShareSource(getShareSourceOptionsModel) + result, response, operationErr = vpcService.GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetShareSource with error: Operation validation and request error`, func() { + It(`Invoke GetVirtualNetworkInterface with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -58941,22 +64144,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetShareSourceOptions model - getShareSourceOptionsModel := new(vpcv1.GetShareSourceOptions) - getShareSourceOptionsModel.ShareID = core.StringPtr("testString") - getShareSourceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetVirtualNetworkInterfaceOptions model + getVirtualNetworkInterfaceOptionsModel := new(vpcv1.GetVirtualNetworkInterfaceOptions) + getVirtualNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + getVirtualNetworkInterfaceOptionsModel.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.GetShareSource(getShareSourceOptionsModel) + result, response, operationErr := vpcService.GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptionsModel) 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 GetShareSourceOptions model with no property values - getShareSourceOptionsModelNew := new(vpcv1.GetShareSourceOptions) + // Construct a second instance of the GetVirtualNetworkInterfaceOptions model with no property values + getVirtualNetworkInterfaceOptionsModelNew := new(vpcv1.GetVirtualNetworkInterfaceOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetShareSource(getShareSourceOptionsModelNew) + result, response, operationErr = vpcService.GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -58974,7 +64177,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetShareSource successfully`, func() { + It(`Invoke GetVirtualNetworkInterface successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -58983,13 +64186,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetShareSourceOptions model - getShareSourceOptionsModel := new(vpcv1.GetShareSourceOptions) - getShareSourceOptionsModel.ShareID = core.StringPtr("testString") - getShareSourceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetVirtualNetworkInterfaceOptions model + getVirtualNetworkInterfaceOptionsModel := new(vpcv1.GetVirtualNetworkInterfaceOptions) + getVirtualNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + getVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetShareSource(getShareSourceOptionsModel) + result, response, operationErr := vpcService.GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -59001,17 +64204,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListRegions(listRegionsOptions *ListRegionsOptions) - Operation response error`, func() { + Describe(`UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptions *UpdateVirtualNetworkInterfaceOptions) - Operation response error`, func() { version := "testString" - listRegionsPath := "/regions" + updateVirtualNetworkInterfacePath := "/virtual_network_interfaces/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(listRegionsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateVirtualNetworkInterfacePath)) + 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") @@ -59019,7 +64222,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListRegions with error: Operation response processing error`, func() { + It(`Invoke UpdateVirtualNetworkInterface with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -59028,18 +64231,29 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListRegionsOptions model - listRegionsOptionsModel := new(vpcv1.ListRegionsOptions) - listRegionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VirtualNetworkInterfacePatch model + virtualNetworkInterfacePatchModel := new(vpcv1.VirtualNetworkInterfacePatch) + virtualNetworkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) + virtualNetworkInterfacePatchModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePatchModel.EnableInfrastructureNat = core.BoolPtr(true) + virtualNetworkInterfacePatchModel.Name = core.StringPtr("my-virtual-network-interface") + virtualNetworkInterfacePatchModelAsPatch, asPatchErr := virtualNetworkInterfacePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVirtualNetworkInterfaceOptions model + updateVirtualNetworkInterfaceOptionsModel := new(vpcv1.UpdateVirtualNetworkInterfaceOptions) + updateVirtualNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + updateVirtualNetworkInterfaceOptionsModel.VirtualNetworkInterfacePatch = virtualNetworkInterfacePatchModelAsPatch + updateVirtualNetworkInterfaceOptionsModel.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.ListRegions(listRegionsOptionsModel) + result, response, operationErr := vpcService.UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptionsModel) 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.ListRegions(listRegionsOptionsModel) + result, response, operationErr = vpcService.UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -59049,17 +64263,33 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListRegions(listRegionsOptions *ListRegionsOptions)`, func() { + Describe(`UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptions *UpdateVirtualNetworkInterfaceOptions)`, func() { version := "testString" - listRegionsPath := "/regions" + updateVirtualNetworkInterfacePath := "/virtual_network_interfaces/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(listRegionsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateVirtualNetworkInterfacePath)) + 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))})) @@ -59069,10 +64299,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"regions": [{"endpoint": "Endpoint", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south", "status": "available"}]}`) + fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "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"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-network-interface", "primary_ip": {"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"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "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"}], "subnet": {"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"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "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"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke ListRegions successfully with retries`, func() { + It(`Invoke UpdateVirtualNetworkInterface successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -59082,20 +64312,31 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListRegionsOptions model - listRegionsOptionsModel := new(vpcv1.ListRegionsOptions) - listRegionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VirtualNetworkInterfacePatch model + virtualNetworkInterfacePatchModel := new(vpcv1.VirtualNetworkInterfacePatch) + virtualNetworkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) + virtualNetworkInterfacePatchModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePatchModel.EnableInfrastructureNat = core.BoolPtr(true) + virtualNetworkInterfacePatchModel.Name = core.StringPtr("my-virtual-network-interface") + virtualNetworkInterfacePatchModelAsPatch, asPatchErr := virtualNetworkInterfacePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVirtualNetworkInterfaceOptions model + updateVirtualNetworkInterfaceOptionsModel := new(vpcv1.UpdateVirtualNetworkInterfaceOptions) + updateVirtualNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + updateVirtualNetworkInterfaceOptionsModel.VirtualNetworkInterfacePatch = virtualNetworkInterfacePatchModelAsPatch + updateVirtualNetworkInterfaceOptionsModel.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.ListRegionsWithContext(ctx, listRegionsOptionsModel) + _, _, operationErr := vpcService.UpdateVirtualNetworkInterfaceWithContext(ctx, updateVirtualNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListRegions(listRegionsOptionsModel) + result, response, operationErr := vpcService.UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -59103,7 +64344,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListRegionsWithContext(ctx, listRegionsOptionsModel) + _, _, operationErr = vpcService.UpdateVirtualNetworkInterfaceWithContext(ctx, updateVirtualNetworkInterfaceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -59117,18 +64358,34 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listRegionsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateVirtualNetworkInterfacePath)) + 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", `{"regions": [{"endpoint": "Endpoint", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south", "status": "available"}]}`) + fmt.Fprintf(res, "%s", `{"allow_ip_spoofing": true, "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "enable_infrastructure_nat": true, "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "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"}], "lifecycle_state": "stable", "mac_address": "02:00:4D:45:45:4D", "name": "my-virtual-network-interface", "primary_ip": {"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"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "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"}], "subnet": {"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"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "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"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) - It(`Invoke ListRegions successfully`, func() { + It(`Invoke UpdateVirtualNetworkInterface successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -59138,23 +64395,34 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListRegions(nil) + result, response, operationErr := vpcService.UpdateVirtualNetworkInterface(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListRegionsOptions model - listRegionsOptionsModel := new(vpcv1.ListRegionsOptions) - listRegionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VirtualNetworkInterfacePatch model + virtualNetworkInterfacePatchModel := new(vpcv1.VirtualNetworkInterfacePatch) + virtualNetworkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) + virtualNetworkInterfacePatchModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePatchModel.EnableInfrastructureNat = core.BoolPtr(true) + virtualNetworkInterfacePatchModel.Name = core.StringPtr("my-virtual-network-interface") + virtualNetworkInterfacePatchModelAsPatch, asPatchErr := virtualNetworkInterfacePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVirtualNetworkInterfaceOptions model + updateVirtualNetworkInterfaceOptionsModel := new(vpcv1.UpdateVirtualNetworkInterfaceOptions) + updateVirtualNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + updateVirtualNetworkInterfaceOptionsModel.VirtualNetworkInterfacePatch = virtualNetworkInterfacePatchModelAsPatch + updateVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListRegions(listRegionsOptionsModel) + result, response, operationErr = vpcService.UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListRegions with error: Operation request error`, func() { + It(`Invoke UpdateVirtualNetworkInterface with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -59163,17 +64431,35 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListRegionsOptions model - listRegionsOptionsModel := new(vpcv1.ListRegionsOptions) - listRegionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VirtualNetworkInterfacePatch model + virtualNetworkInterfacePatchModel := new(vpcv1.VirtualNetworkInterfacePatch) + virtualNetworkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) + virtualNetworkInterfacePatchModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePatchModel.EnableInfrastructureNat = core.BoolPtr(true) + virtualNetworkInterfacePatchModel.Name = core.StringPtr("my-virtual-network-interface") + virtualNetworkInterfacePatchModelAsPatch, asPatchErr := virtualNetworkInterfacePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVirtualNetworkInterfaceOptions model + updateVirtualNetworkInterfaceOptionsModel := new(vpcv1.UpdateVirtualNetworkInterfaceOptions) + updateVirtualNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + updateVirtualNetworkInterfaceOptionsModel.VirtualNetworkInterfacePatch = virtualNetworkInterfacePatchModelAsPatch + updateVirtualNetworkInterfaceOptionsModel.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.ListRegions(listRegionsOptionsModel) + result, response, operationErr := vpcService.UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptionsModel) 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 UpdateVirtualNetworkInterfaceOptions model with no property values + updateVirtualNetworkInterfaceOptionsModelNew := new(vpcv1.UpdateVirtualNetworkInterfaceOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -59188,7 +64474,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListRegions successfully`, func() { + It(`Invoke UpdateVirtualNetworkInterface successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -59197,12 +64483,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListRegionsOptions model - listRegionsOptionsModel := new(vpcv1.ListRegionsOptions) - listRegionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the VirtualNetworkInterfacePatch model + virtualNetworkInterfacePatchModel := new(vpcv1.VirtualNetworkInterfacePatch) + virtualNetworkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) + virtualNetworkInterfacePatchModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePatchModel.EnableInfrastructureNat = core.BoolPtr(true) + virtualNetworkInterfacePatchModel.Name = core.StringPtr("my-virtual-network-interface") + virtualNetworkInterfacePatchModelAsPatch, asPatchErr := virtualNetworkInterfacePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVirtualNetworkInterfaceOptions model + updateVirtualNetworkInterfaceOptionsModel := new(vpcv1.UpdateVirtualNetworkInterfaceOptions) + updateVirtualNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") + updateVirtualNetworkInterfaceOptionsModel.VirtualNetworkInterfacePatch = virtualNetworkInterfacePatchModelAsPatch + updateVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListRegions(listRegionsOptionsModel) + result, response, operationErr := vpcService.UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -59214,25 +64511,28 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetRegion(getRegionOptions *GetRegionOptions) - Operation response error`, func() { + Describe(`ListNetworkInterfaceFloatingIps(listNetworkInterfaceFloatingIpsOptions *ListNetworkInterfaceFloatingIpsOptions) - Operation response error`, func() { version := "testString" - getRegionPath := "/regions/testString" + listNetworkInterfaceFloatingIpsPath := "/virtual_network_interfaces/testString/floating_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(getRegionPath)) + Expect(req.URL.EscapedPath()).To(Equal(listNetworkInterfaceFloatingIpsPath)) 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(10))})) + 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 GetRegion with error: Operation response processing error`, func() { + It(`Invoke ListNetworkInterfaceFloatingIps with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -59241,19 +64541,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetRegionOptions model - getRegionOptionsModel := new(vpcv1.GetRegionOptions) - getRegionOptionsModel.Name = core.StringPtr("testString") - getRegionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListNetworkInterfaceFloatingIpsOptions model + listNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListNetworkInterfaceFloatingIpsOptions) + listNetworkInterfaceFloatingIpsOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + listNetworkInterfaceFloatingIpsOptionsModel.Start = core.StringPtr("testString") + listNetworkInterfaceFloatingIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listNetworkInterfaceFloatingIpsOptionsModel.Sort = core.StringPtr("name") + listNetworkInterfaceFloatingIpsOptionsModel.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.GetRegion(getRegionOptionsModel) + result, response, operationErr := vpcService.ListNetworkInterfaceFloatingIps(listNetworkInterfaceFloatingIpsOptionsModel) 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.GetRegion(getRegionOptionsModel) + result, response, operationErr = vpcService.ListNetworkInterfaceFloatingIps(listNetworkInterfaceFloatingIpsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -59263,30 +64566,33 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetRegion(getRegionOptions *GetRegionOptions)`, func() { + Describe(`ListNetworkInterfaceFloatingIps(listNetworkInterfaceFloatingIpsOptions *ListNetworkInterfaceFloatingIpsOptions)`, func() { version := "testString" - getRegionPath := "/regions/testString" + listNetworkInterfaceFloatingIpsPath := "/virtual_network_interfaces/testString/floating_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(getRegionPath)) + Expect(req.URL.EscapedPath()).To(Equal(listNetworkInterfaceFloatingIpsPath)) 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(10))})) + 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", `{"endpoint": "Endpoint", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south", "status": "available"}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9/floating_ips?limit=20"}, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9/floating_ips?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) })) }) - It(`Invoke GetRegion successfully with retries`, func() { + It(`Invoke ListNetworkInterfaceFloatingIps successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -59296,21 +64602,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetRegionOptions model - getRegionOptionsModel := new(vpcv1.GetRegionOptions) - getRegionOptionsModel.Name = core.StringPtr("testString") - getRegionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListNetworkInterfaceFloatingIpsOptions model + listNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListNetworkInterfaceFloatingIpsOptions) + listNetworkInterfaceFloatingIpsOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + listNetworkInterfaceFloatingIpsOptionsModel.Start = core.StringPtr("testString") + listNetworkInterfaceFloatingIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listNetworkInterfaceFloatingIpsOptionsModel.Sort = core.StringPtr("name") + listNetworkInterfaceFloatingIpsOptionsModel.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.GetRegionWithContext(ctx, getRegionOptionsModel) + _, _, operationErr := vpcService.ListNetworkInterfaceFloatingIpsWithContext(ctx, listNetworkInterfaceFloatingIpsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetRegion(getRegionOptionsModel) + result, response, operationErr := vpcService.ListNetworkInterfaceFloatingIps(listNetworkInterfaceFloatingIpsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -59318,7 +64627,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetRegionWithContext(ctx, getRegionOptionsModel) + _, _, operationErr = vpcService.ListNetworkInterfaceFloatingIpsWithContext(ctx, listNetworkInterfaceFloatingIpsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -59332,18 +64641,21 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getRegionPath)) + Expect(req.URL.EscapedPath()).To(Equal(listNetworkInterfaceFloatingIpsPath)) 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(10))})) + 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", `{"endpoint": "Endpoint", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south", "status": "available"}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9/floating_ips?limit=20"}, "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9/floating_ips?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) })) }) - It(`Invoke GetRegion successfully`, func() { + It(`Invoke ListNetworkInterfaceFloatingIps successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -59353,24 +64665,27 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetRegion(nil) + result, response, operationErr := vpcService.ListNetworkInterfaceFloatingIps(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetRegionOptions model - getRegionOptionsModel := new(vpcv1.GetRegionOptions) - getRegionOptionsModel.Name = core.StringPtr("testString") - getRegionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListNetworkInterfaceFloatingIpsOptions model + listNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListNetworkInterfaceFloatingIpsOptions) + listNetworkInterfaceFloatingIpsOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + listNetworkInterfaceFloatingIpsOptionsModel.Start = core.StringPtr("testString") + listNetworkInterfaceFloatingIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listNetworkInterfaceFloatingIpsOptionsModel.Sort = core.StringPtr("name") + listNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetRegion(getRegionOptionsModel) + result, response, operationErr = vpcService.ListNetworkInterfaceFloatingIps(listNetworkInterfaceFloatingIpsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetRegion with error: Operation validation and request error`, func() { + It(`Invoke ListNetworkInterfaceFloatingIps with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -59379,22 +64694,25 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetRegionOptions model - getRegionOptionsModel := new(vpcv1.GetRegionOptions) - getRegionOptionsModel.Name = core.StringPtr("testString") - getRegionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListNetworkInterfaceFloatingIpsOptions model + listNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListNetworkInterfaceFloatingIpsOptions) + listNetworkInterfaceFloatingIpsOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + listNetworkInterfaceFloatingIpsOptionsModel.Start = core.StringPtr("testString") + listNetworkInterfaceFloatingIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listNetworkInterfaceFloatingIpsOptionsModel.Sort = core.StringPtr("name") + listNetworkInterfaceFloatingIpsOptionsModel.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.GetRegion(getRegionOptionsModel) + result, response, operationErr := vpcService.ListNetworkInterfaceFloatingIps(listNetworkInterfaceFloatingIpsOptionsModel) 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 GetRegionOptions model with no property values - getRegionOptionsModelNew := new(vpcv1.GetRegionOptions) + // Construct a second instance of the ListNetworkInterfaceFloatingIpsOptions model with no property values + listNetworkInterfaceFloatingIpsOptionsModelNew := new(vpcv1.ListNetworkInterfaceFloatingIpsOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetRegion(getRegionOptionsModelNew) + result, response, operationErr = vpcService.ListNetworkInterfaceFloatingIps(listNetworkInterfaceFloatingIpsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -59412,7 +64730,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetRegion successfully`, func() { + It(`Invoke ListNetworkInterfaceFloatingIps successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -59421,13 +64739,16 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetRegionOptions model - getRegionOptionsModel := new(vpcv1.GetRegionOptions) - getRegionOptionsModel.Name = core.StringPtr("testString") - getRegionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListNetworkInterfaceFloatingIpsOptions model + listNetworkInterfaceFloatingIpsOptionsModel := new(vpcv1.ListNetworkInterfaceFloatingIpsOptions) + listNetworkInterfaceFloatingIpsOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + listNetworkInterfaceFloatingIpsOptionsModel.Start = core.StringPtr("testString") + listNetworkInterfaceFloatingIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listNetworkInterfaceFloatingIpsOptionsModel.Sort = core.StringPtr("name") + listNetworkInterfaceFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetRegion(getRegionOptionsModel) + result, response, operationErr := vpcService.ListNetworkInterfaceFloatingIps(listNetworkInterfaceFloatingIpsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -59438,17 +64759,197 @@ var _ = Describe(`VpcV1`, func() { testServer.Close() }) }) + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(vpcv1.FloatingIPCollectionVirtualNetworkInterfaceContext) + nextObject := new(vpcv1.FloatingIPCollectionVirtualNetworkInterfaceContextNext) + 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.FloatingIPCollectionVirtualNetworkInterfaceContext) + + 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.FloatingIPCollectionVirtualNetworkInterfaceContext) + nextObject := new(vpcv1.FloatingIPCollectionVirtualNetworkInterfaceContextNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { + BeforeEach(func() { + var requestNumber int = 0 + 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(listNetworkInterfaceFloatingIpsPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"floating_ips":[{"address":"203.0.113.1","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689","id":"39300233-9995-4806-89a5-3c1b6eb88689","name":"my-floating-ip"}]}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"floating_ips":[{"address":"203.0.113.1","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689","id":"39300233-9995-4806-89a5-3c1b6eb88689","name":"my-floating-ip"}]}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use NetworkInterfaceFloatingIpsPager.GetNext 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()) + + listNetworkInterfaceFloatingIpsOptionsModel := &vpcv1.ListNetworkInterfaceFloatingIpsOptions{ + VirtualNetworkInterfaceID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Sort: core.StringPtr("name"), + } + + pager, err := vpcService.NewNetworkInterfaceFloatingIpsPager(listNetworkInterfaceFloatingIpsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.FloatingIPReference + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) + }) + It(`Use NetworkInterfaceFloatingIpsPager.GetAll 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()) + + listNetworkInterfaceFloatingIpsOptionsModel := &vpcv1.ListNetworkInterfaceFloatingIpsOptions{ + VirtualNetworkInterfaceID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Sort: core.StringPtr("name"), + } + + pager, err := vpcService.NewNetworkInterfaceFloatingIpsPager(listNetworkInterfaceFloatingIpsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) + }) + }) + }) + Describe(`RemoveNetworkInterfaceFloatingIP(removeNetworkInterfaceFloatingIPOptions *RemoveNetworkInterfaceFloatingIPOptions)`, func() { + version := "testString" + removeNetworkInterfaceFloatingIPPath := "/virtual_network_interfaces/testString/floating_ips/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(removeNetworkInterfaceFloatingIPPath)) + 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(204) + })) + }) + It(`Invoke RemoveNetworkInterfaceFloatingIP 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.RemoveNetworkInterfaceFloatingIP(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the RemoveNetworkInterfaceFloatingIPOptions model + removeNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.RemoveNetworkInterfaceFloatingIPOptions) + removeNetworkInterfaceFloatingIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + removeNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + removeNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.RemoveNetworkInterfaceFloatingIP(removeNetworkInterfaceFloatingIPOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke RemoveNetworkInterfaceFloatingIP 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 RemoveNetworkInterfaceFloatingIPOptions model + removeNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.RemoveNetworkInterfaceFloatingIPOptions) + removeNetworkInterfaceFloatingIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + removeNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + removeNetworkInterfaceFloatingIPOptionsModel.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.RemoveNetworkInterfaceFloatingIP(removeNetworkInterfaceFloatingIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the RemoveNetworkInterfaceFloatingIPOptions model with no property values + removeNetworkInterfaceFloatingIPOptionsModelNew := new(vpcv1.RemoveNetworkInterfaceFloatingIPOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.RemoveNetworkInterfaceFloatingIP(removeNetworkInterfaceFloatingIPOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) }) - Describe(`ListRegionZones(listRegionZonesOptions *ListRegionZonesOptions) - Operation response error`, func() { + Describe(`GetNetworkInterfaceFloatingIP(getNetworkInterfaceFloatingIPOptions *GetNetworkInterfaceFloatingIPOptions) - Operation response error`, func() { version := "testString" - listRegionZonesPath := "/regions/testString/zones" + getNetworkInterfaceFloatingIPPath := "/virtual_network_interfaces/testString/floating_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(listRegionZonesPath)) + Expect(req.URL.EscapedPath()).To(Equal(getNetworkInterfaceFloatingIPPath)) 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))})) @@ -59457,7 +64958,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListRegionZones with error: Operation response processing error`, func() { + It(`Invoke GetNetworkInterfaceFloatingIP with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -59466,19 +64967,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListRegionZonesOptions model - listRegionZonesOptionsModel := new(vpcv1.ListRegionZonesOptions) - listRegionZonesOptionsModel.RegionName = core.StringPtr("testString") - listRegionZonesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetNetworkInterfaceFloatingIPOptions model + getNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetNetworkInterfaceFloatingIPOptions) + getNetworkInterfaceFloatingIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + getNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + getNetworkInterfaceFloatingIPOptionsModel.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.ListRegionZones(listRegionZonesOptionsModel) + result, response, operationErr := vpcService.GetNetworkInterfaceFloatingIP(getNetworkInterfaceFloatingIPOptionsModel) 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.ListRegionZones(listRegionZonesOptionsModel) + result, response, operationErr = vpcService.GetNetworkInterfaceFloatingIP(getNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -59488,16 +64990,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListRegionZones(listRegionZonesOptions *ListRegionZonesOptions)`, func() { + Describe(`GetNetworkInterfaceFloatingIP(getNetworkInterfaceFloatingIPOptions *GetNetworkInterfaceFloatingIPOptions)`, func() { version := "testString" - listRegionZonesPath := "/regions/testString/zones" + getNetworkInterfaceFloatingIPPath := "/virtual_network_interfaces/testString/floating_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(listRegionZonesPath)) + Expect(req.URL.EscapedPath()).To(Equal(getNetworkInterfaceFloatingIPPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -59508,10 +65010,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1", "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}, "status": "available"}]}`) + fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}`) })) }) - It(`Invoke ListRegionZones successfully with retries`, func() { + It(`Invoke GetNetworkInterfaceFloatingIP successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -59521,21 +65023,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListRegionZonesOptions model - listRegionZonesOptionsModel := new(vpcv1.ListRegionZonesOptions) - listRegionZonesOptionsModel.RegionName = core.StringPtr("testString") - listRegionZonesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetNetworkInterfaceFloatingIPOptions model + getNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetNetworkInterfaceFloatingIPOptions) + getNetworkInterfaceFloatingIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + getNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + getNetworkInterfaceFloatingIPOptionsModel.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.ListRegionZonesWithContext(ctx, listRegionZonesOptionsModel) + _, _, operationErr := vpcService.GetNetworkInterfaceFloatingIPWithContext(ctx, getNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListRegionZones(listRegionZonesOptionsModel) + result, response, operationErr := vpcService.GetNetworkInterfaceFloatingIP(getNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -59543,7 +65046,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListRegionZonesWithContext(ctx, listRegionZonesOptionsModel) + _, _, operationErr = vpcService.GetNetworkInterfaceFloatingIPWithContext(ctx, getNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -59557,7 +65060,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listRegionZonesPath)) + Expect(req.URL.EscapedPath()).To(Equal(getNetworkInterfaceFloatingIPPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -59565,10 +65068,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"zones": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1", "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}, "status": "available"}]}`) + fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}`) })) }) - It(`Invoke ListRegionZones successfully`, func() { + It(`Invoke GetNetworkInterfaceFloatingIP successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -59578,24 +65081,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListRegionZones(nil) + result, response, operationErr := vpcService.GetNetworkInterfaceFloatingIP(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListRegionZonesOptions model - listRegionZonesOptionsModel := new(vpcv1.ListRegionZonesOptions) - listRegionZonesOptionsModel.RegionName = core.StringPtr("testString") - listRegionZonesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetNetworkInterfaceFloatingIPOptions model + getNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetNetworkInterfaceFloatingIPOptions) + getNetworkInterfaceFloatingIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + getNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + getNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListRegionZones(listRegionZonesOptionsModel) + result, response, operationErr = vpcService.GetNetworkInterfaceFloatingIP(getNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListRegionZones with error: Operation validation and request error`, func() { + It(`Invoke GetNetworkInterfaceFloatingIP with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -59604,22 +65108,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListRegionZonesOptions model - listRegionZonesOptionsModel := new(vpcv1.ListRegionZonesOptions) - listRegionZonesOptionsModel.RegionName = core.StringPtr("testString") - listRegionZonesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetNetworkInterfaceFloatingIPOptions model + getNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetNetworkInterfaceFloatingIPOptions) + getNetworkInterfaceFloatingIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + getNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + getNetworkInterfaceFloatingIPOptionsModel.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.ListRegionZones(listRegionZonesOptionsModel) + result, response, operationErr := vpcService.GetNetworkInterfaceFloatingIP(getNetworkInterfaceFloatingIPOptionsModel) 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 ListRegionZonesOptions model with no property values - listRegionZonesOptionsModelNew := new(vpcv1.ListRegionZonesOptions) + // Construct a second instance of the GetNetworkInterfaceFloatingIPOptions model with no property values + getNetworkInterfaceFloatingIPOptionsModelNew := new(vpcv1.GetNetworkInterfaceFloatingIPOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListRegionZones(listRegionZonesOptionsModelNew) + result, response, operationErr = vpcService.GetNetworkInterfaceFloatingIP(getNetworkInterfaceFloatingIPOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -59637,7 +65142,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListRegionZones successfully`, func() { + It(`Invoke GetNetworkInterfaceFloatingIP successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -59646,13 +65151,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListRegionZonesOptions model - listRegionZonesOptionsModel := new(vpcv1.ListRegionZonesOptions) - listRegionZonesOptionsModel.RegionName = core.StringPtr("testString") - listRegionZonesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetNetworkInterfaceFloatingIPOptions model + getNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.GetNetworkInterfaceFloatingIPOptions) + getNetworkInterfaceFloatingIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + getNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + getNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListRegionZones(listRegionZonesOptionsModel) + result, response, operationErr := vpcService.GetNetworkInterfaceFloatingIP(getNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -59664,17 +65170,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetRegionZone(getRegionZoneOptions *GetRegionZoneOptions) - Operation response error`, func() { + Describe(`AddNetworkInterfaceFloatingIP(addNetworkInterfaceFloatingIPOptions *AddNetworkInterfaceFloatingIPOptions) - Operation response error`, func() { version := "testString" - getRegionZonePath := "/regions/testString/zones/testString" + addNetworkInterfaceFloatingIPPath := "/virtual_network_interfaces/testString/floating_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(getRegionZonePath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(addNetworkInterfaceFloatingIPPath)) + Expect(req.Method).To(Equal("PUT")) 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") @@ -59682,29 +65188,29 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetRegionZone with error: Operation response processing error`, func() { + It(`Invoke AddNetworkInterfaceFloatingIP 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 GetRegionZoneOptions model - getRegionZoneOptionsModel := new(vpcv1.GetRegionZoneOptions) - getRegionZoneOptionsModel.RegionName = core.StringPtr("testString") - getRegionZoneOptionsModel.Name = core.StringPtr("testString") - getRegionZoneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the AddNetworkInterfaceFloatingIPOptions model + addNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddNetworkInterfaceFloatingIPOptions) + addNetworkInterfaceFloatingIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + addNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + addNetworkInterfaceFloatingIPOptionsModel.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.GetRegionZone(getRegionZoneOptionsModel) + result, response, operationErr := vpcService.AddNetworkInterfaceFloatingIP(addNetworkInterfaceFloatingIPOptionsModel) 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.GetRegionZone(getRegionZoneOptionsModel) + result, response, operationErr = vpcService.AddNetworkInterfaceFloatingIP(addNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -59714,17 +65220,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetRegionZone(getRegionZoneOptions *GetRegionZoneOptions)`, func() { + Describe(`AddNetworkInterfaceFloatingIP(addNetworkInterfaceFloatingIPOptions *AddNetworkInterfaceFloatingIPOptions)`, func() { version := "testString" - getRegionZonePath := "/regions/testString/zones/testString" + addNetworkInterfaceFloatingIPPath := "/virtual_network_interfaces/testString/floating_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(getRegionZonePath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(addNetworkInterfaceFloatingIPPath)) + Expect(req.Method).To(Equal("PUT")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -59734,10 +65240,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1", "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}, "status": "available"}`) + fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}`) })) }) - It(`Invoke GetRegionZone successfully with retries`, func() { + It(`Invoke AddNetworkInterfaceFloatingIP successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -59747,22 +65253,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetRegionZoneOptions model - getRegionZoneOptionsModel := new(vpcv1.GetRegionZoneOptions) - getRegionZoneOptionsModel.RegionName = core.StringPtr("testString") - getRegionZoneOptionsModel.Name = core.StringPtr("testString") - getRegionZoneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddNetworkInterfaceFloatingIPOptions model + addNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddNetworkInterfaceFloatingIPOptions) + addNetworkInterfaceFloatingIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + addNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + addNetworkInterfaceFloatingIPOptionsModel.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.GetRegionZoneWithContext(ctx, getRegionZoneOptionsModel) + _, _, operationErr := vpcService.AddNetworkInterfaceFloatingIPWithContext(ctx, addNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetRegionZone(getRegionZoneOptionsModel) + result, response, operationErr := vpcService.AddNetworkInterfaceFloatingIP(addNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -59770,7 +65276,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetRegionZoneWithContext(ctx, getRegionZoneOptionsModel) + _, _, operationErr = vpcService.AddNetworkInterfaceFloatingIPWithContext(ctx, addNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -59784,18 +65290,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getRegionZonePath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(addNetworkInterfaceFloatingIPPath)) + Expect(req.Method).To(Equal("PUT")) 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", `{"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1", "region": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south"}, "status": "available"}`) + fmt.Fprintf(res, "%s", `{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/floating_ips/39300233-9995-4806-89a5-3c1b6eb88689", "id": "39300233-9995-4806-89a5-3c1b6eb88689", "name": "my-floating-ip"}`) })) }) - It(`Invoke GetRegionZone successfully`, func() { + It(`Invoke AddNetworkInterfaceFloatingIP successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -59805,25 +65311,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetRegionZone(nil) + result, response, operationErr := vpcService.AddNetworkInterfaceFloatingIP(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetRegionZoneOptions model - getRegionZoneOptionsModel := new(vpcv1.GetRegionZoneOptions) - getRegionZoneOptionsModel.RegionName = core.StringPtr("testString") - getRegionZoneOptionsModel.Name = core.StringPtr("testString") - getRegionZoneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddNetworkInterfaceFloatingIPOptions model + addNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddNetworkInterfaceFloatingIPOptions) + addNetworkInterfaceFloatingIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + addNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + addNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetRegionZone(getRegionZoneOptionsModel) + result, response, operationErr = vpcService.AddNetworkInterfaceFloatingIP(addNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetRegionZone with error: Operation validation and request error`, func() { + It(`Invoke AddNetworkInterfaceFloatingIP with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -59832,23 +65338,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetRegionZoneOptions model - getRegionZoneOptionsModel := new(vpcv1.GetRegionZoneOptions) - getRegionZoneOptionsModel.RegionName = core.StringPtr("testString") - getRegionZoneOptionsModel.Name = core.StringPtr("testString") - getRegionZoneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddNetworkInterfaceFloatingIPOptions model + addNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddNetworkInterfaceFloatingIPOptions) + addNetworkInterfaceFloatingIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + addNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + addNetworkInterfaceFloatingIPOptionsModel.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.GetRegionZone(getRegionZoneOptionsModel) + result, response, operationErr := vpcService.AddNetworkInterfaceFloatingIP(addNetworkInterfaceFloatingIPOptionsModel) 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 GetRegionZoneOptions model with no property values - getRegionZoneOptionsModelNew := new(vpcv1.GetRegionZoneOptions) + // Construct a second instance of the AddNetworkInterfaceFloatingIPOptions model with no property values + addNetworkInterfaceFloatingIPOptionsModelNew := new(vpcv1.AddNetworkInterfaceFloatingIPOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetRegionZone(getRegionZoneOptionsModelNew) + result, response, operationErr = vpcService.AddNetworkInterfaceFloatingIP(addNetworkInterfaceFloatingIPOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -59866,7 +65372,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetRegionZone successfully`, func() { + It(`Invoke AddNetworkInterfaceFloatingIP successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -59875,14 +65381,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetRegionZoneOptions model - getRegionZoneOptionsModel := new(vpcv1.GetRegionZoneOptions) - getRegionZoneOptionsModel.RegionName = core.StringPtr("testString") - getRegionZoneOptionsModel.Name = core.StringPtr("testString") - getRegionZoneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddNetworkInterfaceFloatingIPOptions model + addNetworkInterfaceFloatingIPOptionsModel := new(vpcv1.AddNetworkInterfaceFloatingIPOptions) + addNetworkInterfaceFloatingIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + addNetworkInterfaceFloatingIPOptionsModel.ID = core.StringPtr("testString") + addNetworkInterfaceFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetRegionZone(getRegionZoneOptionsModel) + result, response, operationErr := vpcService.AddNetworkInterfaceFloatingIP(addNetworkInterfaceFloatingIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -59894,28 +65400,28 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptions *ListVirtualNetworkInterfacesOptions) - Operation response error`, func() { + Describe(`ListVirtualNetworkInterfaceIps(listVirtualNetworkInterfaceIpsOptions *ListVirtualNetworkInterfaceIpsOptions) - Operation response error`, func() { version := "testString" - listVirtualNetworkInterfacesPath := "/virtual_network_interfaces" + listVirtualNetworkInterfaceIpsPath := "/virtual_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(listVirtualNetworkInterfacesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listVirtualNetworkInterfaceIpsPath)) 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(10))})) - 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 ListVirtualNetworkInterfaces with error: Operation response processing error`, func() { + It(`Invoke ListVirtualNetworkInterfaceIps with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -59924,21 +65430,22 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListVirtualNetworkInterfacesOptions model - listVirtualNetworkInterfacesOptionsModel := new(vpcv1.ListVirtualNetworkInterfacesOptions) - listVirtualNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") - listVirtualNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVirtualNetworkInterfacesOptionsModel.ResourceGroupID = core.StringPtr("testString") - listVirtualNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListVirtualNetworkInterfaceIpsOptions model + listVirtualNetworkInterfaceIpsOptionsModel := new(vpcv1.ListVirtualNetworkInterfaceIpsOptions) + listVirtualNetworkInterfaceIpsOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + listVirtualNetworkInterfaceIpsOptionsModel.Start = core.StringPtr("testString") + listVirtualNetworkInterfaceIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listVirtualNetworkInterfaceIpsOptionsModel.Sort = core.StringPtr("name") + listVirtualNetworkInterfaceIpsOptionsModel.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.ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptionsModel) + result, response, operationErr := vpcService.ListVirtualNetworkInterfaceIps(listVirtualNetworkInterfaceIpsOptionsModel) 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.ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptionsModel) + result, response, operationErr = vpcService.ListVirtualNetworkInterfaceIps(listVirtualNetworkInterfaceIpsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -59948,33 +65455,33 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptions *ListVirtualNetworkInterfacesOptions)`, func() { + Describe(`ListVirtualNetworkInterfaceIps(listVirtualNetworkInterfaceIpsOptions *ListVirtualNetworkInterfaceIpsOptions)`, func() { version := "testString" - listVirtualNetworkInterfacesPath := "/virtual_network_interfaces" + listVirtualNetworkInterfaceIpsPath := "/virtual_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(listVirtualNetworkInterfacesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listVirtualNetworkInterfaceIpsPath)) 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(10))})) - 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/virtual_network_interfaces?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces?start=d3e721fd-c988-4670-9927-dbd5e7b07fc6&limit=20"}, "total_count": 132, "virtual_network_interfaces": [{"auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "lifecycle_state": "stable", "name": "my-virtual-network-interface", "primary_ip": {"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"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "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"}], "subnet": {"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"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "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"}, "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", `{"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", "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"}], "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 ListVirtualNetworkInterfaces successfully with retries`, func() { + It(`Invoke ListVirtualNetworkInterfaceIps successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -59984,23 +65491,24 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the ListVirtualNetworkInterfacesOptions model - listVirtualNetworkInterfacesOptionsModel := new(vpcv1.ListVirtualNetworkInterfacesOptions) - listVirtualNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") - listVirtualNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVirtualNetworkInterfacesOptionsModel.ResourceGroupID = core.StringPtr("testString") - listVirtualNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListVirtualNetworkInterfaceIpsOptions model + listVirtualNetworkInterfaceIpsOptionsModel := new(vpcv1.ListVirtualNetworkInterfaceIpsOptions) + listVirtualNetworkInterfaceIpsOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + listVirtualNetworkInterfaceIpsOptionsModel.Start = core.StringPtr("testString") + listVirtualNetworkInterfaceIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listVirtualNetworkInterfaceIpsOptionsModel.Sort = core.StringPtr("name") + listVirtualNetworkInterfaceIpsOptionsModel.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.ListVirtualNetworkInterfacesWithContext(ctx, listVirtualNetworkInterfacesOptionsModel) + _, _, operationErr := vpcService.ListVirtualNetworkInterfaceIpsWithContext(ctx, listVirtualNetworkInterfaceIpsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptionsModel) + result, response, operationErr := vpcService.ListVirtualNetworkInterfaceIps(listVirtualNetworkInterfaceIpsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -60008,7 +65516,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.ListVirtualNetworkInterfacesWithContext(ctx, listVirtualNetworkInterfacesOptionsModel) + _, _, operationErr = vpcService.ListVirtualNetworkInterfaceIpsWithContext(ctx, listVirtualNetworkInterfaceIpsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -60022,21 +65530,21 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listVirtualNetworkInterfacesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listVirtualNetworkInterfaceIpsPath)) 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(10))})) - 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/virtual_network_interfaces?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces?start=d3e721fd-c988-4670-9927-dbd5e7b07fc6&limit=20"}, "total_count": 132, "virtual_network_interfaces": [{"auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "lifecycle_state": "stable", "name": "my-virtual-network-interface", "primary_ip": {"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"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "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"}], "subnet": {"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"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "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"}, "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", `{"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", "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"}], "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 ListVirtualNetworkInterfaces successfully`, func() { + It(`Invoke ListVirtualNetworkInterfaceIps successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -60046,26 +65554,27 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListVirtualNetworkInterfaces(nil) + result, response, operationErr := vpcService.ListVirtualNetworkInterfaceIps(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListVirtualNetworkInterfacesOptions model - listVirtualNetworkInterfacesOptionsModel := new(vpcv1.ListVirtualNetworkInterfacesOptions) - listVirtualNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") - listVirtualNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVirtualNetworkInterfacesOptionsModel.ResourceGroupID = core.StringPtr("testString") - listVirtualNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListVirtualNetworkInterfaceIpsOptions model + listVirtualNetworkInterfaceIpsOptionsModel := new(vpcv1.ListVirtualNetworkInterfaceIpsOptions) + listVirtualNetworkInterfaceIpsOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + listVirtualNetworkInterfaceIpsOptionsModel.Start = core.StringPtr("testString") + listVirtualNetworkInterfaceIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listVirtualNetworkInterfaceIpsOptionsModel.Sort = core.StringPtr("name") + listVirtualNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptionsModel) + result, response, operationErr = vpcService.ListVirtualNetworkInterfaceIps(listVirtualNetworkInterfaceIpsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListVirtualNetworkInterfaces with error: Operation request error`, func() { + It(`Invoke ListVirtualNetworkInterfaceIps with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -60074,20 +65583,28 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListVirtualNetworkInterfacesOptions model - listVirtualNetworkInterfacesOptionsModel := new(vpcv1.ListVirtualNetworkInterfacesOptions) - listVirtualNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") - listVirtualNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVirtualNetworkInterfacesOptionsModel.ResourceGroupID = core.StringPtr("testString") - listVirtualNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListVirtualNetworkInterfaceIpsOptions model + listVirtualNetworkInterfaceIpsOptionsModel := new(vpcv1.ListVirtualNetworkInterfaceIpsOptions) + listVirtualNetworkInterfaceIpsOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + listVirtualNetworkInterfaceIpsOptionsModel.Start = core.StringPtr("testString") + listVirtualNetworkInterfaceIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listVirtualNetworkInterfaceIpsOptionsModel.Sort = core.StringPtr("name") + listVirtualNetworkInterfaceIpsOptionsModel.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.ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptionsModel) + result, response, operationErr := vpcService.ListVirtualNetworkInterfaceIps(listVirtualNetworkInterfaceIpsOptionsModel) 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 ListVirtualNetworkInterfaceIpsOptions model with no property values + listVirtualNetworkInterfaceIpsOptionsModelNew := new(vpcv1.ListVirtualNetworkInterfaceIpsOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListVirtualNetworkInterfaceIps(listVirtualNetworkInterfaceIpsOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -60102,7 +65619,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListVirtualNetworkInterfaces successfully`, func() { + It(`Invoke ListVirtualNetworkInterfaceIps successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -60111,15 +65628,16 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ListVirtualNetworkInterfacesOptions model - listVirtualNetworkInterfacesOptionsModel := new(vpcv1.ListVirtualNetworkInterfacesOptions) - listVirtualNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") - listVirtualNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVirtualNetworkInterfacesOptionsModel.ResourceGroupID = core.StringPtr("testString") - listVirtualNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListVirtualNetworkInterfaceIpsOptions model + listVirtualNetworkInterfaceIpsOptionsModel := new(vpcv1.ListVirtualNetworkInterfaceIpsOptions) + listVirtualNetworkInterfaceIpsOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + listVirtualNetworkInterfaceIpsOptionsModel.Start = core.StringPtr("testString") + listVirtualNetworkInterfaceIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listVirtualNetworkInterfaceIpsOptionsModel.Sort = core.StringPtr("name") + listVirtualNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptionsModel) + result, response, operationErr := vpcService.ListVirtualNetworkInterfaceIps(listVirtualNetworkInterfaceIpsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -60132,8 +65650,8 @@ var _ = Describe(`VpcV1`, func() { }) Context(`Test pagination helper method on response`, func() { It(`Invoke GetNextStart successfully`, func() { - responseObject := new(vpcv1.VirtualNetworkInterfaceCollection) - nextObject := new(vpcv1.VirtualNetworkInterfaceCollectionNext) + responseObject := new(vpcv1.ReservedIPCollectionVirtualNetworkInterfaceContext) + nextObject := new(vpcv1.ReservedIPCollectionVirtualNetworkInterfaceContextNext) nextObject.Href = core.StringPtr("ibm.com?start=abc-123") responseObject.Next = nextObject @@ -60142,15 +65660,15 @@ var _ = Describe(`VpcV1`, func() { Expect(value).To(Equal(core.StringPtr("abc-123"))) }) It(`Invoke GetNextStart without a "Next" property in the response`, func() { - responseObject := new(vpcv1.VirtualNetworkInterfaceCollection) + responseObject := new(vpcv1.ReservedIPCollectionVirtualNetworkInterfaceContext) 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.VirtualNetworkInterfaceCollection) - nextObject := new(vpcv1.VirtualNetworkInterfaceCollectionNext) + responseObject := new(vpcv1.ReservedIPCollectionVirtualNetworkInterfaceContext) + nextObject := new(vpcv1.ReservedIPCollectionVirtualNetworkInterfaceContextNext) nextObject.Href = core.StringPtr("ibm.com") responseObject.Next = nextObject @@ -60166,7 +65684,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listVirtualNetworkInterfacesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listVirtualNetworkInterfaceIpsPath)) Expect(req.Method).To(Equal("GET")) // Set mock response @@ -60174,15 +65692,15 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) requestNumber++ if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"virtual_network_interfaces":[{"auto_delete":false,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","id":"0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","lifecycle_state":"stable","name":"my-virtual-network-interface","primary_ip":{"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"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"virtual_network_interface","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"}],"subnet":{"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"},"target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c","id":"4cf9171a-0043-4434-8727-15b53dbc374c","name":"my-share-mount-target","resource_type":"share_mount_target"},"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"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1}`) + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"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"}]}`) } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"virtual_network_interfaces":[{"auto_delete":false,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","href":"https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","id":"0767-fa41aecb-4f21-423d-8082-630bfba1e1d9","lifecycle_state":"stable","name":"my-virtual-network-interface","primary_ip":{"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"},"resource_group":{"href":"https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345","id":"fee82deba12e4c0fb69c3b09d1f12345","name":"my-resource-group"},"resource_type":"virtual_network_interface","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"}],"subnet":{"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"},"target":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c","id":"4cf9171a-0043-4434-8727-15b53dbc374c","name":"my-share-mount-target","resource_type":"share_mount_target"},"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"},"zone":{"href":"https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1","name":"us-south-1"}}],"total_count":2,"limit":1}`) + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"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"}]}`) } else { res.WriteHeader(400) } })) }) - It(`Use VirtualNetworkInterfacesPager.GetNext successfully`, func() { + It(`Use VirtualNetworkInterfaceIpsPager.GetNext successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -60191,16 +65709,17 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listVirtualNetworkInterfacesOptionsModel := &vpcv1.ListVirtualNetworkInterfacesOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), + listVirtualNetworkInterfaceIpsOptionsModel := &vpcv1.ListVirtualNetworkInterfaceIpsOptions{ + VirtualNetworkInterfaceID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Sort: core.StringPtr("name"), } - pager, err := vpcService.NewVirtualNetworkInterfacesPager(listVirtualNetworkInterfacesOptionsModel) + pager, err := vpcService.NewVirtualNetworkInterfaceIpsPager(listVirtualNetworkInterfaceIpsOptionsModel) Expect(err).To(BeNil()) Expect(pager).ToNot(BeNil()) - var allResults []vpcv1.VirtualNetworkInterface + var allResults []vpcv1.ReservedIPReference for pager.HasNext() { nextPage, err := pager.GetNext() Expect(err).To(BeNil()) @@ -60209,7 +65728,7 @@ var _ = Describe(`VpcV1`, func() { } Expect(len(allResults)).To(Equal(2)) }) - It(`Use VirtualNetworkInterfacesPager.GetAll successfully`, func() { + It(`Use VirtualNetworkInterfaceIpsPager.GetAll successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -60218,12 +65737,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - listVirtualNetworkInterfacesOptionsModel := &vpcv1.ListVirtualNetworkInterfacesOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), + listVirtualNetworkInterfaceIpsOptionsModel := &vpcv1.ListVirtualNetworkInterfaceIpsOptions{ + VirtualNetworkInterfaceID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Sort: core.StringPtr("name"), } - pager, err := vpcService.NewVirtualNetworkInterfacesPager(listVirtualNetworkInterfacesOptionsModel) + pager, err := vpcService.NewVirtualNetworkInterfaceIpsPager(listVirtualNetworkInterfaceIpsOptionsModel) Expect(err).To(BeNil()) Expect(pager).ToNot(BeNil()) @@ -60234,16 +65754,91 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptions *GetVirtualNetworkInterfaceOptions) - Operation response error`, func() { + Describe(`RemoveVirtualNetworkInterfaceIP(removeVirtualNetworkInterfaceIPOptions *RemoveVirtualNetworkInterfaceIPOptions)`, func() { version := "testString" - getVirtualNetworkInterfacePath := "/virtual_network_interfaces/testString" + removeVirtualNetworkInterfaceIPPath := "/virtual_network_interfaces/testString/ips/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(removeVirtualNetworkInterfaceIPPath)) + 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(204) + })) + }) + It(`Invoke RemoveVirtualNetworkInterfaceIP 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.RemoveVirtualNetworkInterfaceIP(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the RemoveVirtualNetworkInterfaceIPOptions model + removeVirtualNetworkInterfaceIPOptionsModel := new(vpcv1.RemoveVirtualNetworkInterfaceIPOptions) + removeVirtualNetworkInterfaceIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + removeVirtualNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") + removeVirtualNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.RemoveVirtualNetworkInterfaceIP(removeVirtualNetworkInterfaceIPOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke RemoveVirtualNetworkInterfaceIP 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 RemoveVirtualNetworkInterfaceIPOptions model + removeVirtualNetworkInterfaceIPOptionsModel := new(vpcv1.RemoveVirtualNetworkInterfaceIPOptions) + removeVirtualNetworkInterfaceIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + removeVirtualNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") + removeVirtualNetworkInterfaceIPOptionsModel.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.RemoveVirtualNetworkInterfaceIP(removeVirtualNetworkInterfaceIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the RemoveVirtualNetworkInterfaceIPOptions model with no property values + removeVirtualNetworkInterfaceIPOptionsModelNew := new(vpcv1.RemoveVirtualNetworkInterfaceIPOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.RemoveVirtualNetworkInterfaceIP(removeVirtualNetworkInterfaceIPOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetVirtualNetworkInterfaceIP(getVirtualNetworkInterfaceIPOptions *GetVirtualNetworkInterfaceIPOptions) - Operation response error`, func() { + version := "testString" + getVirtualNetworkInterfaceIPPath := "/virtual_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(getVirtualNetworkInterfacePath)) + Expect(req.URL.EscapedPath()).To(Equal(getVirtualNetworkInterfaceIPPath)) 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))})) @@ -60252,7 +65847,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetVirtualNetworkInterface with error: Operation response processing error`, func() { + It(`Invoke GetVirtualNetworkInterfaceIP with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -60261,19 +65856,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetVirtualNetworkInterfaceOptions model - getVirtualNetworkInterfaceOptionsModel := new(vpcv1.GetVirtualNetworkInterfaceOptions) - getVirtualNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - getVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetVirtualNetworkInterfaceIPOptions model + getVirtualNetworkInterfaceIPOptionsModel := new(vpcv1.GetVirtualNetworkInterfaceIPOptions) + getVirtualNetworkInterfaceIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + getVirtualNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") + getVirtualNetworkInterfaceIPOptionsModel.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.GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.GetVirtualNetworkInterfaceIP(getVirtualNetworkInterfaceIPOptionsModel) 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.GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptionsModel) + result, response, operationErr = vpcService.GetVirtualNetworkInterfaceIP(getVirtualNetworkInterfaceIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -60283,16 +65879,16 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptions *GetVirtualNetworkInterfaceOptions)`, func() { + Describe(`GetVirtualNetworkInterfaceIP(getVirtualNetworkInterfaceIPOptions *GetVirtualNetworkInterfaceIPOptions)`, func() { version := "testString" - getVirtualNetworkInterfacePath := "/virtual_network_interfaces/testString" + getVirtualNetworkInterfaceIPPath := "/virtual_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(getVirtualNetworkInterfacePath)) + Expect(req.URL.EscapedPath()).To(Equal(getVirtualNetworkInterfaceIPPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -60303,10 +65899,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "lifecycle_state": "stable", "name": "my-virtual-network-interface", "primary_ip": {"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"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "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"}], "subnet": {"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"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "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"}, "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", `{"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"}`) })) }) - It(`Invoke GetVirtualNetworkInterface successfully with retries`, func() { + It(`Invoke GetVirtualNetworkInterfaceIP successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -60316,21 +65912,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the GetVirtualNetworkInterfaceOptions model - getVirtualNetworkInterfaceOptionsModel := new(vpcv1.GetVirtualNetworkInterfaceOptions) - getVirtualNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - getVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetVirtualNetworkInterfaceIPOptions model + getVirtualNetworkInterfaceIPOptionsModel := new(vpcv1.GetVirtualNetworkInterfaceIPOptions) + getVirtualNetworkInterfaceIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + getVirtualNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") + getVirtualNetworkInterfaceIPOptionsModel.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.GetVirtualNetworkInterfaceWithContext(ctx, getVirtualNetworkInterfaceOptionsModel) + _, _, operationErr := vpcService.GetVirtualNetworkInterfaceIPWithContext(ctx, getVirtualNetworkInterfaceIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.GetVirtualNetworkInterfaceIP(getVirtualNetworkInterfaceIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -60338,7 +65935,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.GetVirtualNetworkInterfaceWithContext(ctx, getVirtualNetworkInterfaceOptionsModel) + _, _, operationErr = vpcService.GetVirtualNetworkInterfaceIPWithContext(ctx, getVirtualNetworkInterfaceIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -60352,7 +65949,7 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getVirtualNetworkInterfacePath)) + Expect(req.URL.EscapedPath()).To(Equal(getVirtualNetworkInterfaceIPPath)) Expect(req.Method).To(Equal("GET")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) @@ -60360,10 +65957,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "lifecycle_state": "stable", "name": "my-virtual-network-interface", "primary_ip": {"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"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "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"}], "subnet": {"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"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "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"}, "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", `{"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"}`) })) }) - It(`Invoke GetVirtualNetworkInterface successfully`, func() { + It(`Invoke GetVirtualNetworkInterfaceIP successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -60373,24 +65970,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetVirtualNetworkInterface(nil) + result, response, operationErr := vpcService.GetVirtualNetworkInterfaceIP(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetVirtualNetworkInterfaceOptions model - getVirtualNetworkInterfaceOptionsModel := new(vpcv1.GetVirtualNetworkInterfaceOptions) - getVirtualNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - getVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetVirtualNetworkInterfaceIPOptions model + getVirtualNetworkInterfaceIPOptionsModel := new(vpcv1.GetVirtualNetworkInterfaceIPOptions) + getVirtualNetworkInterfaceIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + getVirtualNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") + getVirtualNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptionsModel) + result, response, operationErr = vpcService.GetVirtualNetworkInterfaceIP(getVirtualNetworkInterfaceIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetVirtualNetworkInterface with error: Operation validation and request error`, func() { + It(`Invoke GetVirtualNetworkInterfaceIP with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -60399,22 +65997,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetVirtualNetworkInterfaceOptions model - getVirtualNetworkInterfaceOptionsModel := new(vpcv1.GetVirtualNetworkInterfaceOptions) - getVirtualNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - getVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetVirtualNetworkInterfaceIPOptions model + getVirtualNetworkInterfaceIPOptionsModel := new(vpcv1.GetVirtualNetworkInterfaceIPOptions) + getVirtualNetworkInterfaceIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + getVirtualNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") + getVirtualNetworkInterfaceIPOptionsModel.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.GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.GetVirtualNetworkInterfaceIP(getVirtualNetworkInterfaceIPOptionsModel) 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 GetVirtualNetworkInterfaceOptions model with no property values - getVirtualNetworkInterfaceOptionsModelNew := new(vpcv1.GetVirtualNetworkInterfaceOptions) + // Construct a second instance of the GetVirtualNetworkInterfaceIPOptions model with no property values + getVirtualNetworkInterfaceIPOptionsModelNew := new(vpcv1.GetVirtualNetworkInterfaceIPOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptionsModelNew) + result, response, operationErr = vpcService.GetVirtualNetworkInterfaceIP(getVirtualNetworkInterfaceIPOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -60432,7 +66031,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetVirtualNetworkInterface successfully`, func() { + It(`Invoke GetVirtualNetworkInterfaceIP successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -60441,13 +66040,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the GetVirtualNetworkInterfaceOptions model - getVirtualNetworkInterfaceOptionsModel := new(vpcv1.GetVirtualNetworkInterfaceOptions) - getVirtualNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - getVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetVirtualNetworkInterfaceIPOptions model + getVirtualNetworkInterfaceIPOptionsModel := new(vpcv1.GetVirtualNetworkInterfaceIPOptions) + getVirtualNetworkInterfaceIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + getVirtualNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") + getVirtualNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.GetVirtualNetworkInterfaceIP(getVirtualNetworkInterfaceIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -60459,17 +66059,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptions *UpdateVirtualNetworkInterfaceOptions) - Operation response error`, func() { + Describe(`AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptions *AddVirtualNetworkInterfaceIPOptions) - Operation response error`, func() { version := "testString" - updateVirtualNetworkInterfacePath := "/virtual_network_interfaces/testString" + addVirtualNetworkInterfaceIPPath := "/virtual_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(updateVirtualNetworkInterfacePath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(addVirtualNetworkInterfaceIPPath)) + Expect(req.Method).To(Equal("PUT")) 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") @@ -60477,7 +66077,7 @@ var _ = Describe(`VpcV1`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateVirtualNetworkInterface with error: Operation response processing error`, func() { + It(`Invoke AddVirtualNetworkInterfaceIP with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -60486,26 +66086,20 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VirtualNetworkInterfacePatch model - virtualNetworkInterfacePatchModel := new(vpcv1.VirtualNetworkInterfacePatch) - virtualNetworkInterfacePatchModel.Name = core.StringPtr("my-virtual-network-interface") - virtualNetworkInterfacePatchModelAsPatch, asPatchErr := virtualNetworkInterfacePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVirtualNetworkInterfaceOptions model - updateVirtualNetworkInterfaceOptionsModel := new(vpcv1.UpdateVirtualNetworkInterfaceOptions) - updateVirtualNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - updateVirtualNetworkInterfaceOptionsModel.VirtualNetworkInterfacePatch = virtualNetworkInterfacePatchModelAsPatch - updateVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddVirtualNetworkInterfaceIPOptions model + addVirtualNetworkInterfaceIPOptionsModel := new(vpcv1.AddVirtualNetworkInterfaceIPOptions) + addVirtualNetworkInterfaceIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + addVirtualNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") + addVirtualNetworkInterfaceIPOptionsModel.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.UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptionsModel) 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.UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptionsModel) + result, response, operationErr = vpcService.AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -60515,33 +66109,17 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptions *UpdateVirtualNetworkInterfaceOptions)`, func() { + Describe(`AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptions *AddVirtualNetworkInterfaceIPOptions)`, func() { version := "testString" - updateVirtualNetworkInterfacePath := "/virtual_network_interfaces/testString" + addVirtualNetworkInterfaceIPPath := "/virtual_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(updateVirtualNetworkInterfacePath)) - 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.EscapedPath()).To(Equal(addVirtualNetworkInterfaceIPPath)) + Expect(req.Method).To(Equal("PUT")) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) @@ -60551,10 +66129,10 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "lifecycle_state": "stable", "name": "my-virtual-network-interface", "primary_ip": {"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"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "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"}], "subnet": {"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"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "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"}, "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", `{"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"}`) })) }) - It(`Invoke UpdateVirtualNetworkInterface successfully with retries`, func() { + It(`Invoke AddVirtualNetworkInterfaceIP successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -60564,28 +66142,22 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the VirtualNetworkInterfacePatch model - virtualNetworkInterfacePatchModel := new(vpcv1.VirtualNetworkInterfacePatch) - virtualNetworkInterfacePatchModel.Name = core.StringPtr("my-virtual-network-interface") - virtualNetworkInterfacePatchModelAsPatch, asPatchErr := virtualNetworkInterfacePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVirtualNetworkInterfaceOptions model - updateVirtualNetworkInterfaceOptionsModel := new(vpcv1.UpdateVirtualNetworkInterfaceOptions) - updateVirtualNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - updateVirtualNetworkInterfaceOptionsModel.VirtualNetworkInterfacePatch = virtualNetworkInterfacePatchModelAsPatch - updateVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddVirtualNetworkInterfaceIPOptions model + addVirtualNetworkInterfaceIPOptionsModel := new(vpcv1.AddVirtualNetworkInterfaceIPOptions) + addVirtualNetworkInterfaceIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + addVirtualNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") + addVirtualNetworkInterfaceIPOptionsModel.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.UpdateVirtualNetworkInterfaceWithContext(ctx, updateVirtualNetworkInterfaceOptionsModel) + _, _, operationErr := vpcService.AddVirtualNetworkInterfaceIPWithContext(ctx, addVirtualNetworkInterfaceIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -60593,7 +66165,7 @@ var _ = Describe(`VpcV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = vpcService.UpdateVirtualNetworkInterfaceWithContext(ctx, updateVirtualNetworkInterfaceOptionsModel) + _, _, operationErr = vpcService.AddVirtualNetworkInterfaceIPWithContext(ctx, addVirtualNetworkInterfaceIPOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -60607,34 +66179,18 @@ var _ = Describe(`VpcV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateVirtualNetworkInterfacePath)) - 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.EscapedPath()).To(Equal(addVirtualNetworkInterfaceIPPath)) + Expect(req.Method).To(Equal("PUT")) 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", `{"auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "href": "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "id": "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9", "lifecycle_state": "stable", "name": "my-virtual-network-interface", "primary_ip": {"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"}, "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "virtual_network_interface", "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"}], "subnet": {"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"}, "target": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/shares/0fe9e5d8-0a4d-4818-96ec-e99708644a58/mount_targets/4cf9171a-0043-4434-8727-15b53dbc374c", "id": "4cf9171a-0043-4434-8727-15b53dbc374c", "name": "my-share-mount-target", "resource_type": "share_mount_target"}, "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"}, "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", `{"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"}`) })) }) - It(`Invoke UpdateVirtualNetworkInterface successfully`, func() { + It(`Invoke AddVirtualNetworkInterfaceIP successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -60644,31 +66200,25 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.UpdateVirtualNetworkInterface(nil) + result, response, operationErr := vpcService.AddVirtualNetworkInterfaceIP(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the VirtualNetworkInterfacePatch model - virtualNetworkInterfacePatchModel := new(vpcv1.VirtualNetworkInterfacePatch) - virtualNetworkInterfacePatchModel.Name = core.StringPtr("my-virtual-network-interface") - virtualNetworkInterfacePatchModelAsPatch, asPatchErr := virtualNetworkInterfacePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVirtualNetworkInterfaceOptions model - updateVirtualNetworkInterfaceOptionsModel := new(vpcv1.UpdateVirtualNetworkInterfaceOptions) - updateVirtualNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - updateVirtualNetworkInterfaceOptionsModel.VirtualNetworkInterfacePatch = virtualNetworkInterfacePatchModelAsPatch - updateVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddVirtualNetworkInterfaceIPOptions model + addVirtualNetworkInterfaceIPOptionsModel := new(vpcv1.AddVirtualNetworkInterfaceIPOptions) + addVirtualNetworkInterfaceIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + addVirtualNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") + addVirtualNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptionsModel) + result, response, operationErr = vpcService.AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateVirtualNetworkInterface with error: Operation validation and request error`, func() { + It(`Invoke AddVirtualNetworkInterfaceIP with error: Operation validation and request error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -60677,29 +66227,23 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VirtualNetworkInterfacePatch model - virtualNetworkInterfacePatchModel := new(vpcv1.VirtualNetworkInterfacePatch) - virtualNetworkInterfacePatchModel.Name = core.StringPtr("my-virtual-network-interface") - virtualNetworkInterfacePatchModelAsPatch, asPatchErr := virtualNetworkInterfacePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVirtualNetworkInterfaceOptions model - updateVirtualNetworkInterfaceOptionsModel := new(vpcv1.UpdateVirtualNetworkInterfaceOptions) - updateVirtualNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - updateVirtualNetworkInterfaceOptionsModel.VirtualNetworkInterfacePatch = virtualNetworkInterfacePatchModelAsPatch - updateVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddVirtualNetworkInterfaceIPOptions model + addVirtualNetworkInterfaceIPOptionsModel := new(vpcv1.AddVirtualNetworkInterfaceIPOptions) + addVirtualNetworkInterfaceIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + addVirtualNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") + addVirtualNetworkInterfaceIPOptionsModel.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.UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptionsModel) 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 UpdateVirtualNetworkInterfaceOptions model with no property values - updateVirtualNetworkInterfaceOptionsModelNew := new(vpcv1.UpdateVirtualNetworkInterfaceOptions) + // Construct a second instance of the AddVirtualNetworkInterfaceIPOptions model with no property values + addVirtualNetworkInterfaceIPOptionsModelNew := new(vpcv1.AddVirtualNetworkInterfaceIPOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptionsModelNew) + result, response, operationErr = vpcService.AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -60717,7 +66261,7 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateVirtualNetworkInterface successfully`, func() { + It(`Invoke AddVirtualNetworkInterfaceIP successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -60726,20 +66270,14 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the VirtualNetworkInterfacePatch model - virtualNetworkInterfacePatchModel := new(vpcv1.VirtualNetworkInterfacePatch) - virtualNetworkInterfacePatchModel.Name = core.StringPtr("my-virtual-network-interface") - virtualNetworkInterfacePatchModelAsPatch, asPatchErr := virtualNetworkInterfacePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVirtualNetworkInterfaceOptions model - updateVirtualNetworkInterfaceOptionsModel := new(vpcv1.UpdateVirtualNetworkInterfaceOptions) - updateVirtualNetworkInterfaceOptionsModel.ID = core.StringPtr("testString") - updateVirtualNetworkInterfaceOptionsModel.VirtualNetworkInterfacePatch = virtualNetworkInterfacePatchModelAsPatch - updateVirtualNetworkInterfaceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddVirtualNetworkInterfaceIPOptions model + addVirtualNetworkInterfaceIPOptionsModel := new(vpcv1.AddVirtualNetworkInterfaceIPOptions) + addVirtualNetworkInterfaceIPOptionsModel.VirtualNetworkInterfaceID = core.StringPtr("testString") + addVirtualNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") + addVirtualNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := vpcService.UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptionsModel) + result, response, operationErr := vpcService.AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -62055,6 +67593,10 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) + Expect(req.URL.Query()["target.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["target.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727"})) + Expect(req.URL.Query()["target.name"]).To(Equal([]string{"my-resource"})) + Expect(req.URL.Query()["target.resource_type"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) @@ -62075,6 +67617,10 @@ var _ = Describe(`VpcV1`, func() { listFloatingIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) listFloatingIpsOptionsModel.ResourceGroupID = core.StringPtr("testString") listFloatingIpsOptionsModel.Sort = core.StringPtr("name") + listFloatingIpsOptionsModel.TargetID = core.StringPtr("testString") + listFloatingIpsOptionsModel.TargetCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727") + listFloatingIpsOptionsModel.TargetName = core.StringPtr("my-resource") + listFloatingIpsOptionsModel.TargetResourceType = core.StringPtr("testString") listFloatingIpsOptionsModel.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.ListFloatingIps(listFloatingIpsOptionsModel) @@ -62112,6 +67658,10 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) + Expect(req.URL.Query()["target.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["target.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727"})) + Expect(req.URL.Query()["target.name"]).To(Equal([]string{"my-resource"})) + Expect(req.URL.Query()["target.resource_type"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) @@ -62137,6 +67687,10 @@ var _ = Describe(`VpcV1`, func() { listFloatingIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) listFloatingIpsOptionsModel.ResourceGroupID = core.StringPtr("testString") listFloatingIpsOptionsModel.Sort = core.StringPtr("name") + listFloatingIpsOptionsModel.TargetID = core.StringPtr("testString") + listFloatingIpsOptionsModel.TargetCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727") + listFloatingIpsOptionsModel.TargetName = core.StringPtr("my-resource") + listFloatingIpsOptionsModel.TargetResourceType = core.StringPtr("testString") listFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error @@ -62179,6 +67733,10 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) + Expect(req.URL.Query()["target.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["target.crn"]).To(Equal([]string{"crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727"})) + Expect(req.URL.Query()["target.name"]).To(Equal([]string{"my-resource"})) + Expect(req.URL.Query()["target.resource_type"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) @@ -62206,6 +67764,10 @@ var _ = Describe(`VpcV1`, func() { listFloatingIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) listFloatingIpsOptionsModel.ResourceGroupID = core.StringPtr("testString") listFloatingIpsOptionsModel.Sort = core.StringPtr("name") + listFloatingIpsOptionsModel.TargetID = core.StringPtr("testString") + listFloatingIpsOptionsModel.TargetCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727") + listFloatingIpsOptionsModel.TargetName = core.StringPtr("my-resource") + listFloatingIpsOptionsModel.TargetResourceType = core.StringPtr("testString") listFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) @@ -62230,6 +67792,10 @@ var _ = Describe(`VpcV1`, func() { listFloatingIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) listFloatingIpsOptionsModel.ResourceGroupID = core.StringPtr("testString") listFloatingIpsOptionsModel.Sort = core.StringPtr("name") + listFloatingIpsOptionsModel.TargetID = core.StringPtr("testString") + listFloatingIpsOptionsModel.TargetCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727") + listFloatingIpsOptionsModel.TargetName = core.StringPtr("my-resource") + listFloatingIpsOptionsModel.TargetResourceType = core.StringPtr("testString") listFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") @@ -62268,6 +67834,10 @@ var _ = Describe(`VpcV1`, func() { listFloatingIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) listFloatingIpsOptionsModel.ResourceGroupID = core.StringPtr("testString") listFloatingIpsOptionsModel.Sort = core.StringPtr("name") + listFloatingIpsOptionsModel.TargetID = core.StringPtr("testString") + listFloatingIpsOptionsModel.TargetCRN = core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727") + listFloatingIpsOptionsModel.TargetName = core.StringPtr("my-resource") + listFloatingIpsOptionsModel.TargetResourceType = core.StringPtr("testString") listFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation @@ -62344,9 +67914,13 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) listFloatingIpsOptionsModel := &vpcv1.ListFloatingIpsOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - Sort: core.StringPtr("name"), + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + Sort: core.StringPtr("name"), + TargetID: core.StringPtr("testString"), + TargetCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727"), + TargetName: core.StringPtr("my-resource"), + TargetResourceType: core.StringPtr("testString"), } pager, err := vpcService.NewFloatingIpsPager(listFloatingIpsOptionsModel) @@ -62372,9 +67946,13 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) listFloatingIpsOptionsModel := &vpcv1.ListFloatingIpsOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - Sort: core.StringPtr("name"), + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + Sort: core.StringPtr("name"), + TargetID: core.StringPtr("testString"), + TargetCRN: core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727"), + TargetName: core.StringPtr("my-resource"), + TargetResourceType: core.StringPtr("testString"), } pager, err := vpcService.NewFloatingIpsPager(listFloatingIpsOptionsModel) @@ -80568,10 +86146,6 @@ var _ = Describe(`VpcV1`, func() { subnetIdentityModel := new(vpcv1.SubnetIdentityByID) subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - // Construct an instance of the LoadBalancerLoggingDatapathPrototype model - loadBalancerLoggingDatapathPrototypeModel := new(vpcv1.LoadBalancerLoggingDatapathPrototype) - loadBalancerLoggingDatapathPrototypeModel.Active = core.BoolPtr(true) - // Construct an instance of the DnsInstanceIdentityByCRN model dnsInstanceIdentityModel := new(vpcv1.DnsInstanceIdentityByCRN) dnsInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:dns-svcs:global:a/123456:6860c359-b2e2-46fa-a944-b38c28201c6e") @@ -80616,6 +86190,10 @@ var _ = Describe(`VpcV1`, func() { loadBalancerListenerPrototypeLoadBalancerContextModel.PortMin = core.Int64Ptr(int64(443)) loadBalancerListenerPrototypeLoadBalancerContextModel.Protocol = core.StringPtr("http") + // Construct an instance of the LoadBalancerLoggingDatapathPrototype model + loadBalancerLoggingDatapathPrototypeModel := new(vpcv1.LoadBalancerLoggingDatapathPrototype) + loadBalancerLoggingDatapathPrototypeModel.Active = core.BoolPtr(true) + // Construct an instance of the LoadBalancerLoggingPrototype model loadBalancerLoggingPrototypeModel := new(vpcv1.LoadBalancerLoggingPrototype) loadBalancerLoggingPrototypeModel.Datapath = loadBalancerLoggingDatapathPrototypeModel @@ -80670,7 +86248,6 @@ var _ = Describe(`VpcV1`, func() { createLoadBalancerOptionsModel := new(vpcv1.CreateLoadBalancerOptions) createLoadBalancerOptionsModel.IsPublic = core.BoolPtr(true) createLoadBalancerOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - createLoadBalancerOptionsModel.Datapath = loadBalancerLoggingDatapathPrototypeModel createLoadBalancerOptionsModel.Dns = loadBalancerDnsPrototypeModel createLoadBalancerOptionsModel.Listeners = []vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext{*loadBalancerListenerPrototypeLoadBalancerContextModel} createLoadBalancerOptionsModel.Logging = loadBalancerLoggingPrototypeModel @@ -80752,10 +86329,6 @@ var _ = Describe(`VpcV1`, func() { subnetIdentityModel := new(vpcv1.SubnetIdentityByID) subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - // Construct an instance of the LoadBalancerLoggingDatapathPrototype model - loadBalancerLoggingDatapathPrototypeModel := new(vpcv1.LoadBalancerLoggingDatapathPrototype) - loadBalancerLoggingDatapathPrototypeModel.Active = core.BoolPtr(true) - // Construct an instance of the DnsInstanceIdentityByCRN model dnsInstanceIdentityModel := new(vpcv1.DnsInstanceIdentityByCRN) dnsInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:dns-svcs:global:a/123456:6860c359-b2e2-46fa-a944-b38c28201c6e") @@ -80800,6 +86373,10 @@ var _ = Describe(`VpcV1`, func() { loadBalancerListenerPrototypeLoadBalancerContextModel.PortMin = core.Int64Ptr(int64(443)) loadBalancerListenerPrototypeLoadBalancerContextModel.Protocol = core.StringPtr("http") + // Construct an instance of the LoadBalancerLoggingDatapathPrototype model + loadBalancerLoggingDatapathPrototypeModel := new(vpcv1.LoadBalancerLoggingDatapathPrototype) + loadBalancerLoggingDatapathPrototypeModel.Active = core.BoolPtr(true) + // Construct an instance of the LoadBalancerLoggingPrototype model loadBalancerLoggingPrototypeModel := new(vpcv1.LoadBalancerLoggingPrototype) loadBalancerLoggingPrototypeModel.Datapath = loadBalancerLoggingDatapathPrototypeModel @@ -80854,7 +86431,6 @@ var _ = Describe(`VpcV1`, func() { createLoadBalancerOptionsModel := new(vpcv1.CreateLoadBalancerOptions) createLoadBalancerOptionsModel.IsPublic = core.BoolPtr(true) createLoadBalancerOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - createLoadBalancerOptionsModel.Datapath = loadBalancerLoggingDatapathPrototypeModel createLoadBalancerOptionsModel.Dns = loadBalancerDnsPrototypeModel createLoadBalancerOptionsModel.Listeners = []vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext{*loadBalancerListenerPrototypeLoadBalancerContextModel} createLoadBalancerOptionsModel.Logging = loadBalancerLoggingPrototypeModel @@ -80943,10 +86519,139 @@ var _ = Describe(`VpcV1`, func() { subnetIdentityModel := new(vpcv1.SubnetIdentityByID) subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + // Construct an instance of the DnsInstanceIdentityByCRN model + dnsInstanceIdentityModel := new(vpcv1.DnsInstanceIdentityByCRN) + dnsInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:dns-svcs:global:a/123456:6860c359-b2e2-46fa-a944-b38c28201c6e") + + // Construct an instance of the DnsZoneIdentityByID model + dnsZoneIdentityModel := new(vpcv1.DnsZoneIdentityByID) + dnsZoneIdentityModel.ID = core.StringPtr("d66662cc-aa23-4fe1-9987-858487a61f45") + + // Construct an instance of the LoadBalancerDnsPrototype model + loadBalancerDnsPrototypeModel := new(vpcv1.LoadBalancerDnsPrototype) + loadBalancerDnsPrototypeModel.Instance = dnsInstanceIdentityModel + loadBalancerDnsPrototypeModel.Zone = dnsZoneIdentityModel + + // 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 LoadBalancerPoolIdentityByName model + loadBalancerPoolIdentityByNameModel := new(vpcv1.LoadBalancerPoolIdentityByName) + loadBalancerPoolIdentityByNameModel.Name = core.StringPtr("my-load-balancer-pool") + + // Construct an instance of the LoadBalancerListenerIdentityByID model + loadBalancerListenerIdentityModel := new(vpcv1.LoadBalancerListenerIdentityByID) + loadBalancerListenerIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the LoadBalancerListenerHTTPSRedirectPrototype model + loadBalancerListenerHTTPSRedirectPrototypeModel := new(vpcv1.LoadBalancerListenerHTTPSRedirectPrototype) + loadBalancerListenerHTTPSRedirectPrototypeModel.HTTPStatusCode = core.Int64Ptr(int64(301)) + loadBalancerListenerHTTPSRedirectPrototypeModel.Listener = loadBalancerListenerIdentityModel + loadBalancerListenerHTTPSRedirectPrototypeModel.URI = core.StringPtr("/example?doc=get") + + // Construct an instance of the LoadBalancerListenerPrototypeLoadBalancerContext model + loadBalancerListenerPrototypeLoadBalancerContextModel := new(vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext) + loadBalancerListenerPrototypeLoadBalancerContextModel.AcceptProxyProtocol = core.BoolPtr(true) + loadBalancerListenerPrototypeLoadBalancerContextModel.CertificateInstance = certificateInstanceIdentityModel + loadBalancerListenerPrototypeLoadBalancerContextModel.ConnectionLimit = core.Int64Ptr(int64(2000)) + loadBalancerListenerPrototypeLoadBalancerContextModel.DefaultPool = loadBalancerPoolIdentityByNameModel + loadBalancerListenerPrototypeLoadBalancerContextModel.HTTPSRedirect = loadBalancerListenerHTTPSRedirectPrototypeModel + loadBalancerListenerPrototypeLoadBalancerContextModel.IdleConnectionTimeout = core.Int64Ptr(int64(100)) + loadBalancerListenerPrototypeLoadBalancerContextModel.Port = core.Int64Ptr(int64(443)) + loadBalancerListenerPrototypeLoadBalancerContextModel.PortMax = core.Int64Ptr(int64(499)) + loadBalancerListenerPrototypeLoadBalancerContextModel.PortMin = core.Int64Ptr(int64(443)) + loadBalancerListenerPrototypeLoadBalancerContextModel.Protocol = core.StringPtr("http") + // Construct an instance of the LoadBalancerLoggingDatapathPrototype model loadBalancerLoggingDatapathPrototypeModel := new(vpcv1.LoadBalancerLoggingDatapathPrototype) loadBalancerLoggingDatapathPrototypeModel.Active = core.BoolPtr(true) + // Construct an instance of the LoadBalancerLoggingPrototype model + loadBalancerLoggingPrototypeModel := new(vpcv1.LoadBalancerLoggingPrototype) + loadBalancerLoggingPrototypeModel.Datapath = loadBalancerLoggingDatapathPrototypeModel + + // Construct an instance of the LoadBalancerPoolHealthMonitorPrototype model + loadBalancerPoolHealthMonitorPrototypeModel := new(vpcv1.LoadBalancerPoolHealthMonitorPrototype) + loadBalancerPoolHealthMonitorPrototypeModel.Delay = core.Int64Ptr(int64(5)) + loadBalancerPoolHealthMonitorPrototypeModel.MaxRetries = core.Int64Ptr(int64(2)) + loadBalancerPoolHealthMonitorPrototypeModel.Port = core.Int64Ptr(int64(22)) + loadBalancerPoolHealthMonitorPrototypeModel.Timeout = core.Int64Ptr(int64(2)) + loadBalancerPoolHealthMonitorPrototypeModel.Type = core.StringPtr("http") + loadBalancerPoolHealthMonitorPrototypeModel.URLPath = core.StringPtr("/") + + // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model + loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") + + // Construct an instance of the LoadBalancerPoolMemberPrototype model + loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) + loadBalancerPoolMemberPrototypeModel.Port = core.Int64Ptr(int64(80)) + loadBalancerPoolMemberPrototypeModel.Target = loadBalancerPoolMemberTargetPrototypeModel + loadBalancerPoolMemberPrototypeModel.Weight = core.Int64Ptr(int64(50)) + + // Construct an instance of the LoadBalancerPoolSessionPersistencePrototype model + loadBalancerPoolSessionPersistencePrototypeModel := new(vpcv1.LoadBalancerPoolSessionPersistencePrototype) + loadBalancerPoolSessionPersistencePrototypeModel.CookieName = core.StringPtr("my-cookie-name") + loadBalancerPoolSessionPersistencePrototypeModel.Type = core.StringPtr("app_cookie") + + // Construct an instance of the LoadBalancerPoolPrototype model + loadBalancerPoolPrototypeModel := new(vpcv1.LoadBalancerPoolPrototype) + loadBalancerPoolPrototypeModel.Algorithm = core.StringPtr("least_connections") + loadBalancerPoolPrototypeModel.HealthMonitor = loadBalancerPoolHealthMonitorPrototypeModel + loadBalancerPoolPrototypeModel.Members = []vpcv1.LoadBalancerPoolMemberPrototype{*loadBalancerPoolMemberPrototypeModel} + loadBalancerPoolPrototypeModel.Name = core.StringPtr("my-load-balancer-pool") + loadBalancerPoolPrototypeModel.Protocol = core.StringPtr("http") + loadBalancerPoolPrototypeModel.ProxyProtocol = core.StringPtr("disabled") + loadBalancerPoolPrototypeModel.SessionPersistence = loadBalancerPoolSessionPersistencePrototypeModel + + // Construct an instance of the LoadBalancerProfileIdentityByName model + loadBalancerProfileIdentityModel := new(vpcv1.LoadBalancerProfileIdentityByName) + loadBalancerProfileIdentityModel.Name = core.StringPtr("network-fixed") + + // 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 CreateLoadBalancerOptions model + createLoadBalancerOptionsModel := new(vpcv1.CreateLoadBalancerOptions) + createLoadBalancerOptionsModel.IsPublic = core.BoolPtr(true) + createLoadBalancerOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + createLoadBalancerOptionsModel.Dns = loadBalancerDnsPrototypeModel + createLoadBalancerOptionsModel.Listeners = []vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext{*loadBalancerListenerPrototypeLoadBalancerContextModel} + createLoadBalancerOptionsModel.Logging = loadBalancerLoggingPrototypeModel + createLoadBalancerOptionsModel.Name = core.StringPtr("my-load-balancer") + createLoadBalancerOptionsModel.Pools = []vpcv1.LoadBalancerPoolPrototype{*loadBalancerPoolPrototypeModel} + createLoadBalancerOptionsModel.Profile = loadBalancerProfileIdentityModel + createLoadBalancerOptionsModel.ResourceGroup = resourceGroupIdentityModel + createLoadBalancerOptionsModel.RouteMode = core.BoolPtr(true) + createLoadBalancerOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + createLoadBalancerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateLoadBalancer(createLoadBalancerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateLoadBalancer 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 SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + // Construct an instance of the DnsInstanceIdentityByCRN model dnsInstanceIdentityModel := new(vpcv1.DnsInstanceIdentityByCRN) dnsInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:dns-svcs:global:a/123456:6860c359-b2e2-46fa-a944-b38c28201c6e") @@ -80991,140 +86696,10 @@ var _ = Describe(`VpcV1`, func() { loadBalancerListenerPrototypeLoadBalancerContextModel.PortMin = core.Int64Ptr(int64(443)) loadBalancerListenerPrototypeLoadBalancerContextModel.Protocol = core.StringPtr("http") - // Construct an instance of the LoadBalancerLoggingPrototype model - loadBalancerLoggingPrototypeModel := new(vpcv1.LoadBalancerLoggingPrototype) - loadBalancerLoggingPrototypeModel.Datapath = loadBalancerLoggingDatapathPrototypeModel - - // Construct an instance of the LoadBalancerPoolHealthMonitorPrototype model - loadBalancerPoolHealthMonitorPrototypeModel := new(vpcv1.LoadBalancerPoolHealthMonitorPrototype) - loadBalancerPoolHealthMonitorPrototypeModel.Delay = core.Int64Ptr(int64(5)) - loadBalancerPoolHealthMonitorPrototypeModel.MaxRetries = core.Int64Ptr(int64(2)) - loadBalancerPoolHealthMonitorPrototypeModel.Port = core.Int64Ptr(int64(22)) - loadBalancerPoolHealthMonitorPrototypeModel.Timeout = core.Int64Ptr(int64(2)) - loadBalancerPoolHealthMonitorPrototypeModel.Type = core.StringPtr("http") - loadBalancerPoolHealthMonitorPrototypeModel.URLPath = core.StringPtr("/") - - // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model - loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") - - // Construct an instance of the LoadBalancerPoolMemberPrototype model - loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) - loadBalancerPoolMemberPrototypeModel.Port = core.Int64Ptr(int64(80)) - loadBalancerPoolMemberPrototypeModel.Target = loadBalancerPoolMemberTargetPrototypeModel - loadBalancerPoolMemberPrototypeModel.Weight = core.Int64Ptr(int64(50)) - - // Construct an instance of the LoadBalancerPoolSessionPersistencePrototype model - loadBalancerPoolSessionPersistencePrototypeModel := new(vpcv1.LoadBalancerPoolSessionPersistencePrototype) - loadBalancerPoolSessionPersistencePrototypeModel.CookieName = core.StringPtr("my-cookie-name") - loadBalancerPoolSessionPersistencePrototypeModel.Type = core.StringPtr("app_cookie") - - // Construct an instance of the LoadBalancerPoolPrototype model - loadBalancerPoolPrototypeModel := new(vpcv1.LoadBalancerPoolPrototype) - loadBalancerPoolPrototypeModel.Algorithm = core.StringPtr("least_connections") - loadBalancerPoolPrototypeModel.HealthMonitor = loadBalancerPoolHealthMonitorPrototypeModel - loadBalancerPoolPrototypeModel.Members = []vpcv1.LoadBalancerPoolMemberPrototype{*loadBalancerPoolMemberPrototypeModel} - loadBalancerPoolPrototypeModel.Name = core.StringPtr("my-load-balancer-pool") - loadBalancerPoolPrototypeModel.Protocol = core.StringPtr("http") - loadBalancerPoolPrototypeModel.ProxyProtocol = core.StringPtr("disabled") - loadBalancerPoolPrototypeModel.SessionPersistence = loadBalancerPoolSessionPersistencePrototypeModel - - // Construct an instance of the LoadBalancerProfileIdentityByName model - loadBalancerProfileIdentityModel := new(vpcv1.LoadBalancerProfileIdentityByName) - loadBalancerProfileIdentityModel.Name = core.StringPtr("network-fixed") - - // 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 CreateLoadBalancerOptions model - createLoadBalancerOptionsModel := new(vpcv1.CreateLoadBalancerOptions) - createLoadBalancerOptionsModel.IsPublic = core.BoolPtr(true) - createLoadBalancerOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - createLoadBalancerOptionsModel.Datapath = loadBalancerLoggingDatapathPrototypeModel - createLoadBalancerOptionsModel.Dns = loadBalancerDnsPrototypeModel - createLoadBalancerOptionsModel.Listeners = []vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext{*loadBalancerListenerPrototypeLoadBalancerContextModel} - createLoadBalancerOptionsModel.Logging = loadBalancerLoggingPrototypeModel - createLoadBalancerOptionsModel.Name = core.StringPtr("my-load-balancer") - createLoadBalancerOptionsModel.Pools = []vpcv1.LoadBalancerPoolPrototype{*loadBalancerPoolPrototypeModel} - createLoadBalancerOptionsModel.Profile = loadBalancerProfileIdentityModel - createLoadBalancerOptionsModel.ResourceGroup = resourceGroupIdentityModel - createLoadBalancerOptionsModel.RouteMode = core.BoolPtr(true) - createLoadBalancerOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - createLoadBalancerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateLoadBalancer(createLoadBalancerOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateLoadBalancer 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 SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - // Construct an instance of the LoadBalancerLoggingDatapathPrototype model loadBalancerLoggingDatapathPrototypeModel := new(vpcv1.LoadBalancerLoggingDatapathPrototype) loadBalancerLoggingDatapathPrototypeModel.Active = core.BoolPtr(true) - // Construct an instance of the DnsInstanceIdentityByCRN model - dnsInstanceIdentityModel := new(vpcv1.DnsInstanceIdentityByCRN) - dnsInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:dns-svcs:global:a/123456:6860c359-b2e2-46fa-a944-b38c28201c6e") - - // Construct an instance of the DnsZoneIdentityByID model - dnsZoneIdentityModel := new(vpcv1.DnsZoneIdentityByID) - dnsZoneIdentityModel.ID = core.StringPtr("d66662cc-aa23-4fe1-9987-858487a61f45") - - // Construct an instance of the LoadBalancerDnsPrototype model - loadBalancerDnsPrototypeModel := new(vpcv1.LoadBalancerDnsPrototype) - loadBalancerDnsPrototypeModel.Instance = dnsInstanceIdentityModel - loadBalancerDnsPrototypeModel.Zone = dnsZoneIdentityModel - - // 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 LoadBalancerPoolIdentityByName model - loadBalancerPoolIdentityByNameModel := new(vpcv1.LoadBalancerPoolIdentityByName) - loadBalancerPoolIdentityByNameModel.Name = core.StringPtr("my-load-balancer-pool") - - // Construct an instance of the LoadBalancerListenerIdentityByID model - loadBalancerListenerIdentityModel := new(vpcv1.LoadBalancerListenerIdentityByID) - loadBalancerListenerIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the LoadBalancerListenerHTTPSRedirectPrototype model - loadBalancerListenerHTTPSRedirectPrototypeModel := new(vpcv1.LoadBalancerListenerHTTPSRedirectPrototype) - loadBalancerListenerHTTPSRedirectPrototypeModel.HTTPStatusCode = core.Int64Ptr(int64(301)) - loadBalancerListenerHTTPSRedirectPrototypeModel.Listener = loadBalancerListenerIdentityModel - loadBalancerListenerHTTPSRedirectPrototypeModel.URI = core.StringPtr("/example?doc=get") - - // Construct an instance of the LoadBalancerListenerPrototypeLoadBalancerContext model - loadBalancerListenerPrototypeLoadBalancerContextModel := new(vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext) - loadBalancerListenerPrototypeLoadBalancerContextModel.AcceptProxyProtocol = core.BoolPtr(true) - loadBalancerListenerPrototypeLoadBalancerContextModel.CertificateInstance = certificateInstanceIdentityModel - loadBalancerListenerPrototypeLoadBalancerContextModel.ConnectionLimit = core.Int64Ptr(int64(2000)) - loadBalancerListenerPrototypeLoadBalancerContextModel.DefaultPool = loadBalancerPoolIdentityByNameModel - loadBalancerListenerPrototypeLoadBalancerContextModel.HTTPSRedirect = loadBalancerListenerHTTPSRedirectPrototypeModel - loadBalancerListenerPrototypeLoadBalancerContextModel.IdleConnectionTimeout = core.Int64Ptr(int64(100)) - loadBalancerListenerPrototypeLoadBalancerContextModel.Port = core.Int64Ptr(int64(443)) - loadBalancerListenerPrototypeLoadBalancerContextModel.PortMax = core.Int64Ptr(int64(499)) - loadBalancerListenerPrototypeLoadBalancerContextModel.PortMin = core.Int64Ptr(int64(443)) - loadBalancerListenerPrototypeLoadBalancerContextModel.Protocol = core.StringPtr("http") - // Construct an instance of the LoadBalancerLoggingPrototype model loadBalancerLoggingPrototypeModel := new(vpcv1.LoadBalancerLoggingPrototype) loadBalancerLoggingPrototypeModel.Datapath = loadBalancerLoggingDatapathPrototypeModel @@ -81179,7 +86754,6 @@ var _ = Describe(`VpcV1`, func() { createLoadBalancerOptionsModel := new(vpcv1.CreateLoadBalancerOptions) createLoadBalancerOptionsModel.IsPublic = core.BoolPtr(true) createLoadBalancerOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - createLoadBalancerOptionsModel.Datapath = loadBalancerLoggingDatapathPrototypeModel createLoadBalancerOptionsModel.Dns = loadBalancerDnsPrototypeModel createLoadBalancerOptionsModel.Listeners = []vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext{*loadBalancerListenerPrototypeLoadBalancerContextModel} createLoadBalancerOptionsModel.Logging = loadBalancerLoggingPrototypeModel @@ -81232,10 +86806,6 @@ var _ = Describe(`VpcV1`, func() { subnetIdentityModel := new(vpcv1.SubnetIdentityByID) subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - // Construct an instance of the LoadBalancerLoggingDatapathPrototype model - loadBalancerLoggingDatapathPrototypeModel := new(vpcv1.LoadBalancerLoggingDatapathPrototype) - loadBalancerLoggingDatapathPrototypeModel.Active = core.BoolPtr(true) - // Construct an instance of the DnsInstanceIdentityByCRN model dnsInstanceIdentityModel := new(vpcv1.DnsInstanceIdentityByCRN) dnsInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:dns-svcs:global:a/123456:6860c359-b2e2-46fa-a944-b38c28201c6e") @@ -81280,6 +86850,10 @@ var _ = Describe(`VpcV1`, func() { loadBalancerListenerPrototypeLoadBalancerContextModel.PortMin = core.Int64Ptr(int64(443)) loadBalancerListenerPrototypeLoadBalancerContextModel.Protocol = core.StringPtr("http") + // Construct an instance of the LoadBalancerLoggingDatapathPrototype model + loadBalancerLoggingDatapathPrototypeModel := new(vpcv1.LoadBalancerLoggingDatapathPrototype) + loadBalancerLoggingDatapathPrototypeModel.Active = core.BoolPtr(true) + // Construct an instance of the LoadBalancerLoggingPrototype model loadBalancerLoggingPrototypeModel := new(vpcv1.LoadBalancerLoggingPrototype) loadBalancerLoggingPrototypeModel.Datapath = loadBalancerLoggingDatapathPrototypeModel @@ -81334,7 +86908,6 @@ var _ = Describe(`VpcV1`, func() { createLoadBalancerOptionsModel := new(vpcv1.CreateLoadBalancerOptions) createLoadBalancerOptionsModel.IsPublic = core.BoolPtr(true) createLoadBalancerOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - createLoadBalancerOptionsModel.Datapath = loadBalancerLoggingDatapathPrototypeModel createLoadBalancerOptionsModel.Dns = loadBalancerDnsPrototypeModel createLoadBalancerOptionsModel.Listeners = []vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext{*loadBalancerListenerPrototypeLoadBalancerContextModel} createLoadBalancerOptionsModel.Logging = loadBalancerLoggingPrototypeModel @@ -82398,7 +87971,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"listeners": [{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "idle_connection_timeout": 100, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "anyValue"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}]}`) + fmt.Fprintf(res, "%s", `{"listeners": [{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "idle_connection_timeout": 100, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-policy"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}]}`) })) }) It(`Invoke ListLoadBalancerListeners successfully with retries`, func() { @@ -82455,7 +88028,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"listeners": [{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "idle_connection_timeout": 100, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "anyValue"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}]}`) + fmt.Fprintf(res, "%s", `{"listeners": [{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "idle_connection_timeout": 100, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-policy"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}]}`) })) }) It(`Invoke ListLoadBalancerListeners successfully`, func() { @@ -82687,7 +88260,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "idle_connection_timeout": 100, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "anyValue"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}`) + fmt.Fprintf(res, "%s", `{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "idle_connection_timeout": 100, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-policy"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}`) })) }) It(`Invoke CreateLoadBalancerListener successfully with retries`, func() { @@ -82808,7 +88381,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "idle_connection_timeout": 100, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "anyValue"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}`) + fmt.Fprintf(res, "%s", `{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "idle_connection_timeout": 100, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-policy"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}`) })) }) It(`Invoke CreateLoadBalancerListener successfully`, func() { @@ -83196,7 +88769,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "idle_connection_timeout": 100, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "anyValue"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}`) + fmt.Fprintf(res, "%s", `{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "idle_connection_timeout": 100, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-policy"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}`) })) }) It(`Invoke GetLoadBalancerListener successfully with retries`, func() { @@ -83254,7 +88827,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "idle_connection_timeout": 100, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "anyValue"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}`) + fmt.Fprintf(res, "%s", `{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "idle_connection_timeout": 100, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-policy"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}`) })) }) It(`Invoke GetLoadBalancerListener successfully`, func() { @@ -83476,7 +89049,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "idle_connection_timeout": 100, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "anyValue"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}`) + fmt.Fprintf(res, "%s", `{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "idle_connection_timeout": 100, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-policy"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}`) })) }) It(`Invoke UpdateLoadBalancerListener successfully with retries`, func() { @@ -83584,7 +89157,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "idle_connection_timeout": 100, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "anyValue"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}`) + fmt.Fprintf(res, "%s", `{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_pool": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-load-balancer-pool"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "idle_connection_timeout": 100, "policies": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-policy"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}`) })) }) It(`Invoke UpdateLoadBalancerListener successfully`, func() { @@ -92640,6 +98213,32 @@ var _ = Describe(`VpcV1`, func() { Expect(addInstanceNetworkInterfaceFloatingIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(addInstanceNetworkInterfaceFloatingIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewAddNetworkInterfaceFloatingIPOptions successfully`, func() { + // Construct an instance of the AddNetworkInterfaceFloatingIPOptions model + virtualNetworkInterfaceID := "testString" + id := "testString" + addNetworkInterfaceFloatingIPOptionsModel := vpcService.NewAddNetworkInterfaceFloatingIPOptions(virtualNetworkInterfaceID, id) + addNetworkInterfaceFloatingIPOptionsModel.SetVirtualNetworkInterfaceID("testString") + addNetworkInterfaceFloatingIPOptionsModel.SetID("testString") + addNetworkInterfaceFloatingIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(addNetworkInterfaceFloatingIPOptionsModel).ToNot(BeNil()) + Expect(addNetworkInterfaceFloatingIPOptionsModel.VirtualNetworkInterfaceID).To(Equal(core.StringPtr("testString"))) + Expect(addNetworkInterfaceFloatingIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(addNetworkInterfaceFloatingIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewAddVirtualNetworkInterfaceIPOptions successfully`, func() { + // Construct an instance of the AddVirtualNetworkInterfaceIPOptions model + virtualNetworkInterfaceID := "testString" + id := "testString" + addVirtualNetworkInterfaceIPOptionsModel := vpcService.NewAddVirtualNetworkInterfaceIPOptions(virtualNetworkInterfaceID, id) + addVirtualNetworkInterfaceIPOptionsModel.SetVirtualNetworkInterfaceID("testString") + addVirtualNetworkInterfaceIPOptionsModel.SetID("testString") + addVirtualNetworkInterfaceIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(addVirtualNetworkInterfaceIPOptionsModel).ToNot(BeNil()) + Expect(addVirtualNetworkInterfaceIPOptionsModel.VirtualNetworkInterfaceID).To(Equal(core.StringPtr("testString"))) + Expect(addVirtualNetworkInterfaceIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(addVirtualNetworkInterfaceIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewAddVPNGatewayConnectionLocalCIDROptions successfully`, func() { // Construct an instance of the AddVPNGatewayConnectionLocalCIDROptions model vpnGatewayID := "testString" @@ -92932,6 +98531,91 @@ var _ = Describe(`VpcV1`, func() { Expect(createBareMetalServerConsoleAccessTokenOptionsModel.Force).To(Equal(core.BoolPtr(false))) Expect(createBareMetalServerConsoleAccessTokenOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewCreateBareMetalServerNetworkAttachmentOptions successfully`, func() { + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + Expect(virtualNetworkInterfaceIPPrototypeModel).ToNot(BeNil()) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + Expect(virtualNetworkInterfaceIPPrototypeModel.Address).To(Equal(core.StringPtr("10.0.0.5"))) + Expect(virtualNetworkInterfaceIPPrototypeModel.AutoDelete).To(Equal(core.BoolPtr(false))) + Expect(virtualNetworkInterfaceIPPrototypeModel.Name).To(Equal(core.StringPtr("my-reserved-ip"))) + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + Expect(virtualNetworkInterfacePrimaryIPPrototypeModel).ToNot(BeNil()) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + Expect(virtualNetworkInterfacePrimaryIPPrototypeModel.Address).To(Equal(core.StringPtr("10.0.0.5"))) + Expect(virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete).To(Equal(core.BoolPtr(false))) + Expect(virtualNetworkInterfacePrimaryIPPrototypeModel.Name).To(Equal(core.StringPtr("my-reserved-ip"))) + + // 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 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 BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext model + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) + Expect(bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel).ToNot(BeNil()) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + Expect(bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing).To(Equal(core.BoolPtr(true))) + Expect(bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete).To(Equal(core.BoolPtr(false))) + Expect(bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat).To(Equal(core.BoolPtr(true))) + Expect(bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips).To(Equal([]vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel})) + Expect(bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name).To(Equal(core.StringPtr("my-virtual-network-interface"))) + Expect(bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP).To(Equal(virtualNetworkInterfacePrimaryIPPrototypeModel)) + Expect(bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) + Expect(bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups).To(Equal([]vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel})) + Expect(bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet).To(Equal(subnetIdentityModel)) + + // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype model + bareMetalServerNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) + Expect(bareMetalServerNetworkAttachmentPrototypeModel).ToNot(BeNil()) + bareMetalServerNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") + bareMetalServerNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + bareMetalServerNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} + bareMetalServerNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") + Expect(bareMetalServerNetworkAttachmentPrototypeModel.Name).To(Equal(core.StringPtr("my-bare-metal-server-network-attachment"))) + Expect(bareMetalServerNetworkAttachmentPrototypeModel.VirtualNetworkInterface).To(Equal(bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel)) + Expect(bareMetalServerNetworkAttachmentPrototypeModel.AllowedVlans).To(Equal([]int64{})) + Expect(bareMetalServerNetworkAttachmentPrototypeModel.InterfaceType).To(Equal(core.StringPtr("pci"))) + + // Construct an instance of the CreateBareMetalServerNetworkAttachmentOptions model + bareMetalServerID := "testString" + var bareMetalServerNetworkAttachmentPrototype vpcv1.BareMetalServerNetworkAttachmentPrototypeIntf = nil + createBareMetalServerNetworkAttachmentOptionsModel := vpcService.NewCreateBareMetalServerNetworkAttachmentOptions(bareMetalServerID, bareMetalServerNetworkAttachmentPrototype) + createBareMetalServerNetworkAttachmentOptionsModel.SetBareMetalServerID("testString") + createBareMetalServerNetworkAttachmentOptionsModel.SetBareMetalServerNetworkAttachmentPrototype(bareMetalServerNetworkAttachmentPrototypeModel) + createBareMetalServerNetworkAttachmentOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createBareMetalServerNetworkAttachmentOptionsModel).ToNot(BeNil()) + Expect(createBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID).To(Equal(core.StringPtr("testString"))) + Expect(createBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerNetworkAttachmentPrototype).To(Equal(bareMetalServerNetworkAttachmentPrototypeModel)) + Expect(createBareMetalServerNetworkAttachmentOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewCreateBareMetalServerNetworkInterfaceOptions successfully`, func() { // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) @@ -93008,78 +98692,12 @@ var _ = Describe(`VpcV1`, func() { Expect(bareMetalServerInitializationPrototypeModel.Keys).To(Equal([]vpcv1.KeyIdentityIntf{keyIdentityModel})) Expect(bareMetalServerInitializationPrototypeModel.UserData).To(Equal(core.StringPtr("testString"))) - // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model - networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) - Expect(networkInterfaceIPPrototypeModel).ToNot(BeNil()) - networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - Expect(networkInterfaceIPPrototypeModel.Address).To(Equal(core.StringPtr("10.0.0.5"))) - Expect(networkInterfaceIPPrototypeModel.AutoDelete).To(Equal(core.BoolPtr(false))) - Expect(networkInterfaceIPPrototypeModel.Name).To(Equal(core.StringPtr("my-reserved-ip"))) - - // 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 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 BareMetalServerPrimaryNetworkInterfacePrototype model - bareMetalServerPrimaryNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerPrimaryNetworkInterfacePrototype) - Expect(bareMetalServerPrimaryNetworkInterfacePrototypeModel).ToNot(BeNil()) - bareMetalServerPrimaryNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerPrimaryNetworkInterfacePrototypeModel.AllowedVlans = []int64{int64(4)} - bareMetalServerPrimaryNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerPrimaryNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("pci") - bareMetalServerPrimaryNetworkInterfacePrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-interface") - bareMetalServerPrimaryNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - bareMetalServerPrimaryNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerPrimaryNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - Expect(bareMetalServerPrimaryNetworkInterfacePrototypeModel.AllowIPSpoofing).To(Equal(core.BoolPtr(true))) - Expect(bareMetalServerPrimaryNetworkInterfacePrototypeModel.AllowedVlans).To(Equal([]int64{int64(4)})) - Expect(bareMetalServerPrimaryNetworkInterfacePrototypeModel.EnableInfrastructureNat).To(Equal(core.BoolPtr(true))) - Expect(bareMetalServerPrimaryNetworkInterfacePrototypeModel.InterfaceType).To(Equal(core.StringPtr("pci"))) - Expect(bareMetalServerPrimaryNetworkInterfacePrototypeModel.Name).To(Equal(core.StringPtr("my-bare-metal-server-network-interface"))) - Expect(bareMetalServerPrimaryNetworkInterfacePrototypeModel.PrimaryIP).To(Equal(networkInterfaceIPPrototypeModel)) - Expect(bareMetalServerPrimaryNetworkInterfacePrototypeModel.SecurityGroups).To(Equal([]vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel})) - Expect(bareMetalServerPrimaryNetworkInterfacePrototypeModel.Subnet).To(Equal(subnetIdentityModel)) - // Construct an instance of the BareMetalServerProfileIdentityByName model bareMetalServerProfileIdentityModel := new(vpcv1.BareMetalServerProfileIdentityByName) Expect(bareMetalServerProfileIdentityModel).ToNot(BeNil()) bareMetalServerProfileIdentityModel.Name = core.StringPtr("bx2-metal-192x768") Expect(bareMetalServerProfileIdentityModel.Name).To(Equal(core.StringPtr("bx2-metal-192x768"))) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - Expect(zoneIdentityModel).ToNot(BeNil()) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - Expect(zoneIdentityModel.Name).To(Equal(core.StringPtr("us-south-1"))) - - // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype model - bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) - Expect(bareMetalServerNetworkInterfacePrototypeModel).ToNot(BeNil()) - bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerNetworkInterfacePrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-interface") - bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") - Expect(bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing).To(Equal(core.BoolPtr(true))) - Expect(bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat).To(Equal(core.BoolPtr(true))) - Expect(bareMetalServerNetworkInterfacePrototypeModel.Name).To(Equal(core.StringPtr("my-bare-metal-server-network-interface"))) - Expect(bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP).To(Equal(networkInterfaceIPPrototypeModel)) - Expect(bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups).To(Equal([]vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel})) - Expect(bareMetalServerNetworkInterfacePrototypeModel.Subnet).To(Equal(subnetIdentityModel)) - Expect(bareMetalServerNetworkInterfacePrototypeModel.InterfaceType).To(Equal(core.StringPtr("hipersocket"))) - // Construct an instance of the ResourceGroupIdentityByID model resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) Expect(resourceGroupIdentityModel).ToNot(BeNil()) @@ -93098,34 +98716,121 @@ var _ = Describe(`VpcV1`, func() { vpcIdentityModel.ID = core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b") Expect(vpcIdentityModel.ID).To(Equal(core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b"))) + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + Expect(zoneIdentityModel).ToNot(BeNil()) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + Expect(zoneIdentityModel.Name).To(Equal(core.StringPtr("us-south-1"))) + + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + Expect(virtualNetworkInterfaceIPPrototypeModel).ToNot(BeNil()) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + Expect(virtualNetworkInterfaceIPPrototypeModel.Address).To(Equal(core.StringPtr("10.0.0.5"))) + Expect(virtualNetworkInterfaceIPPrototypeModel.AutoDelete).To(Equal(core.BoolPtr(false))) + Expect(virtualNetworkInterfaceIPPrototypeModel.Name).To(Equal(core.StringPtr("my-reserved-ip"))) + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + Expect(virtualNetworkInterfacePrimaryIPPrototypeModel).ToNot(BeNil()) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + Expect(virtualNetworkInterfacePrimaryIPPrototypeModel.Address).To(Equal(core.StringPtr("10.0.0.5"))) + Expect(virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete).To(Equal(core.BoolPtr(false))) + Expect(virtualNetworkInterfacePrimaryIPPrototypeModel.Name).To(Equal(core.StringPtr("my-reserved-ip"))) + + // 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 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 BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext model + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) + Expect(bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel).ToNot(BeNil()) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + Expect(bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing).To(Equal(core.BoolPtr(true))) + Expect(bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete).To(Equal(core.BoolPtr(false))) + Expect(bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat).To(Equal(core.BoolPtr(true))) + Expect(bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips).To(Equal([]vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel})) + Expect(bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name).To(Equal(core.StringPtr("my-virtual-network-interface"))) + Expect(bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP).To(Equal(virtualNetworkInterfacePrimaryIPPrototypeModel)) + Expect(bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) + Expect(bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups).To(Equal([]vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel})) + Expect(bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet).To(Equal(subnetIdentityModel)) + + // Construct an instance of the BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype model + bareMetalServerNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) + Expect(bareMetalServerNetworkAttachmentPrototypeModel).ToNot(BeNil()) + bareMetalServerNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") + bareMetalServerNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + bareMetalServerNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} + bareMetalServerNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") + Expect(bareMetalServerNetworkAttachmentPrototypeModel.Name).To(Equal(core.StringPtr("my-bare-metal-server-network-attachment"))) + Expect(bareMetalServerNetworkAttachmentPrototypeModel.VirtualNetworkInterface).To(Equal(bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel)) + Expect(bareMetalServerNetworkAttachmentPrototypeModel.AllowedVlans).To(Equal([]int64{})) + Expect(bareMetalServerNetworkAttachmentPrototypeModel.InterfaceType).To(Equal(core.StringPtr("pci"))) + + // Construct an instance of the BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype model + bareMetalServerPrimaryNetworkAttachmentPrototypeModel := new(vpcv1.BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype) + Expect(bareMetalServerPrimaryNetworkAttachmentPrototypeModel).ToNot(BeNil()) + bareMetalServerPrimaryNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-bare-metal-server-network-attachment") + bareMetalServerPrimaryNetworkAttachmentPrototypeModel.VirtualNetworkInterface = bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + bareMetalServerPrimaryNetworkAttachmentPrototypeModel.AllowedVlans = []int64{} + bareMetalServerPrimaryNetworkAttachmentPrototypeModel.InterfaceType = core.StringPtr("pci") + Expect(bareMetalServerPrimaryNetworkAttachmentPrototypeModel.Name).To(Equal(core.StringPtr("my-bare-metal-server-network-attachment"))) + Expect(bareMetalServerPrimaryNetworkAttachmentPrototypeModel.VirtualNetworkInterface).To(Equal(bareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceModel)) + Expect(bareMetalServerPrimaryNetworkAttachmentPrototypeModel.AllowedVlans).To(Equal([]int64{})) + Expect(bareMetalServerPrimaryNetworkAttachmentPrototypeModel.InterfaceType).To(Equal(core.StringPtr("pci"))) + + // Construct an instance of the BareMetalServerPrototypeBareMetalServerByNetworkAttachment model + bareMetalServerPrototypeModel := new(vpcv1.BareMetalServerPrototypeBareMetalServerByNetworkAttachment) + Expect(bareMetalServerPrototypeModel).ToNot(BeNil()) + bareMetalServerPrototypeModel.EnableSecureBoot = core.BoolPtr(false) + bareMetalServerPrototypeModel.Initialization = bareMetalServerInitializationPrototypeModel + bareMetalServerPrototypeModel.Name = core.StringPtr("my-bare-metal-server") + bareMetalServerPrototypeModel.Profile = bareMetalServerProfileIdentityModel + bareMetalServerPrototypeModel.ResourceGroup = resourceGroupIdentityModel + bareMetalServerPrototypeModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePrototypeModel + bareMetalServerPrototypeModel.VPC = vpcIdentityModel + bareMetalServerPrototypeModel.Zone = zoneIdentityModel + bareMetalServerPrototypeModel.NetworkAttachments = []vpcv1.BareMetalServerNetworkAttachmentPrototypeIntf{bareMetalServerNetworkAttachmentPrototypeModel} + bareMetalServerPrototypeModel.PrimaryNetworkAttachment = bareMetalServerPrimaryNetworkAttachmentPrototypeModel + Expect(bareMetalServerPrototypeModel.EnableSecureBoot).To(Equal(core.BoolPtr(false))) + Expect(bareMetalServerPrototypeModel.Initialization).To(Equal(bareMetalServerInitializationPrototypeModel)) + Expect(bareMetalServerPrototypeModel.Name).To(Equal(core.StringPtr("my-bare-metal-server"))) + Expect(bareMetalServerPrototypeModel.Profile).To(Equal(bareMetalServerProfileIdentityModel)) + Expect(bareMetalServerPrototypeModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) + Expect(bareMetalServerPrototypeModel.TrustedPlatformModule).To(Equal(bareMetalServerTrustedPlatformModulePrototypeModel)) + Expect(bareMetalServerPrototypeModel.VPC).To(Equal(vpcIdentityModel)) + Expect(bareMetalServerPrototypeModel.Zone).To(Equal(zoneIdentityModel)) + Expect(bareMetalServerPrototypeModel.NetworkAttachments).To(Equal([]vpcv1.BareMetalServerNetworkAttachmentPrototypeIntf{bareMetalServerNetworkAttachmentPrototypeModel})) + Expect(bareMetalServerPrototypeModel.PrimaryNetworkAttachment).To(Equal(bareMetalServerPrimaryNetworkAttachmentPrototypeModel)) + // Construct an instance of the CreateBareMetalServerOptions model - var createBareMetalServerOptionsInitialization *vpcv1.BareMetalServerInitializationPrototype = nil - var createBareMetalServerOptionsPrimaryNetworkInterface *vpcv1.BareMetalServerPrimaryNetworkInterfacePrototype = nil - var createBareMetalServerOptionsProfile vpcv1.BareMetalServerProfileIdentityIntf = nil - var createBareMetalServerOptionsZone vpcv1.ZoneIdentityIntf = nil - createBareMetalServerOptionsModel := vpcService.NewCreateBareMetalServerOptions(createBareMetalServerOptionsInitialization, createBareMetalServerOptionsPrimaryNetworkInterface, createBareMetalServerOptionsProfile, createBareMetalServerOptionsZone) - createBareMetalServerOptionsModel.SetInitialization(bareMetalServerInitializationPrototypeModel) - createBareMetalServerOptionsModel.SetPrimaryNetworkInterface(bareMetalServerPrimaryNetworkInterfacePrototypeModel) - createBareMetalServerOptionsModel.SetProfile(bareMetalServerProfileIdentityModel) - createBareMetalServerOptionsModel.SetZone(zoneIdentityModel) - createBareMetalServerOptionsModel.SetEnableSecureBoot(false) - createBareMetalServerOptionsModel.SetName("my-bare-metal-server") - createBareMetalServerOptionsModel.SetNetworkInterfaces([]vpcv1.BareMetalServerNetworkInterfacePrototypeIntf{bareMetalServerNetworkInterfacePrototypeModel}) - createBareMetalServerOptionsModel.SetResourceGroup(resourceGroupIdentityModel) - createBareMetalServerOptionsModel.SetTrustedPlatformModule(bareMetalServerTrustedPlatformModulePrototypeModel) - createBareMetalServerOptionsModel.SetVPC(vpcIdentityModel) + var bareMetalServerPrototype vpcv1.BareMetalServerPrototypeIntf = nil + createBareMetalServerOptionsModel := vpcService.NewCreateBareMetalServerOptions(bareMetalServerPrototype) + createBareMetalServerOptionsModel.SetBareMetalServerPrototype(bareMetalServerPrototypeModel) createBareMetalServerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(createBareMetalServerOptionsModel).ToNot(BeNil()) - Expect(createBareMetalServerOptionsModel.Initialization).To(Equal(bareMetalServerInitializationPrototypeModel)) - Expect(createBareMetalServerOptionsModel.PrimaryNetworkInterface).To(Equal(bareMetalServerPrimaryNetworkInterfacePrototypeModel)) - Expect(createBareMetalServerOptionsModel.Profile).To(Equal(bareMetalServerProfileIdentityModel)) - Expect(createBareMetalServerOptionsModel.Zone).To(Equal(zoneIdentityModel)) - Expect(createBareMetalServerOptionsModel.EnableSecureBoot).To(Equal(core.BoolPtr(false))) - Expect(createBareMetalServerOptionsModel.Name).To(Equal(core.StringPtr("my-bare-metal-server"))) - Expect(createBareMetalServerOptionsModel.NetworkInterfaces).To(Equal([]vpcv1.BareMetalServerNetworkInterfacePrototypeIntf{bareMetalServerNetworkInterfacePrototypeModel})) - Expect(createBareMetalServerOptionsModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) - Expect(createBareMetalServerOptionsModel.TrustedPlatformModule).To(Equal(bareMetalServerTrustedPlatformModulePrototypeModel)) - Expect(createBareMetalServerOptionsModel.VPC).To(Equal(vpcIdentityModel)) + Expect(createBareMetalServerOptionsModel.BareMetalServerPrototype).To(Equal(bareMetalServerPrototypeModel)) Expect(createBareMetalServerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewCreateDedicatedHostGroupOptions successfully`, func() { @@ -93610,6 +99315,81 @@ var _ = Describe(`VpcV1`, func() { Expect(createInstanceGroupOptionsModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) Expect(createInstanceGroupOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewCreateInstanceNetworkAttachmentOptions successfully`, func() { + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + Expect(virtualNetworkInterfaceIPPrototypeModel).ToNot(BeNil()) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + Expect(virtualNetworkInterfaceIPPrototypeModel.Address).To(Equal(core.StringPtr("10.0.0.5"))) + Expect(virtualNetworkInterfaceIPPrototypeModel.AutoDelete).To(Equal(core.BoolPtr(false))) + Expect(virtualNetworkInterfaceIPPrototypeModel.Name).To(Equal(core.StringPtr("my-reserved-ip"))) + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + Expect(virtualNetworkInterfacePrimaryIPPrototypeModel).ToNot(BeNil()) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.7") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + Expect(virtualNetworkInterfacePrimaryIPPrototypeModel.Address).To(Equal(core.StringPtr("10.0.0.7"))) + Expect(virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete).To(Equal(core.BoolPtr(false))) + Expect(virtualNetworkInterfacePrimaryIPPrototypeModel.Name).To(Equal(core.StringPtr("my-reserved-ip"))) + + // 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 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 InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext model + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) + Expect(instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel).ToNot(BeNil()) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + Expect(instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing).To(Equal(core.BoolPtr(true))) + Expect(instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete).To(Equal(core.BoolPtr(false))) + Expect(instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat).To(Equal(core.BoolPtr(true))) + Expect(instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips).To(Equal([]vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel})) + Expect(instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name).To(Equal(core.StringPtr("my-virtual-network-interface"))) + Expect(instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP).To(Equal(virtualNetworkInterfacePrimaryIPPrototypeModel)) + Expect(instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) + Expect(instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups).To(Equal([]vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel})) + Expect(instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet).To(Equal(subnetIdentityModel)) + + // Construct an instance of the CreateInstanceNetworkAttachmentOptions model + instanceID := "testString" + var createInstanceNetworkAttachmentOptionsVirtualNetworkInterface vpcv1.InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf = nil + createInstanceNetworkAttachmentOptionsModel := vpcService.NewCreateInstanceNetworkAttachmentOptions(instanceID, createInstanceNetworkAttachmentOptionsVirtualNetworkInterface) + createInstanceNetworkAttachmentOptionsModel.SetInstanceID("testString") + createInstanceNetworkAttachmentOptionsModel.SetVirtualNetworkInterface(instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel) + createInstanceNetworkAttachmentOptionsModel.SetName("testString") + createInstanceNetworkAttachmentOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createInstanceNetworkAttachmentOptionsModel).ToNot(BeNil()) + Expect(createInstanceNetworkAttachmentOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) + Expect(createInstanceNetworkAttachmentOptionsModel.VirtualNetworkInterface).To(Equal(instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel)) + Expect(createInstanceNetworkAttachmentOptionsModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(createInstanceNetworkAttachmentOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewCreateInstanceNetworkInterfaceOptions successfully`, func() { // Construct an instance of the SubnetIdentityByID model subnetIdentityModel := new(vpcv1.SubnetIdentityByID) @@ -93818,8 +99598,58 @@ 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 InstancePrototypeInstanceByImage model - instancePrototypeModel := new(vpcv1.InstancePrototypeInstanceByImage) + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + Expect(virtualNetworkInterfaceIPPrototypeModel).ToNot(BeNil()) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + Expect(virtualNetworkInterfaceIPPrototypeModel.Address).To(Equal(core.StringPtr("10.0.0.5"))) + Expect(virtualNetworkInterfaceIPPrototypeModel.AutoDelete).To(Equal(core.BoolPtr(false))) + Expect(virtualNetworkInterfaceIPPrototypeModel.Name).To(Equal(core.StringPtr("my-reserved-ip"))) + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + Expect(virtualNetworkInterfacePrimaryIPPrototypeModel).ToNot(BeNil()) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + Expect(virtualNetworkInterfacePrimaryIPPrototypeModel.Address).To(Equal(core.StringPtr("10.0.0.5"))) + Expect(virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete).To(Equal(core.BoolPtr(false))) + Expect(virtualNetworkInterfacePrimaryIPPrototypeModel.Name).To(Equal(core.StringPtr("my-reserved-ip"))) + + // Construct an instance of the InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext model + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) + Expect(instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel).ToNot(BeNil()) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + Expect(instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing).To(Equal(core.BoolPtr(true))) + Expect(instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete).To(Equal(core.BoolPtr(false))) + Expect(instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat).To(Equal(core.BoolPtr(true))) + Expect(instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips).To(Equal([]vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel})) + Expect(instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name).To(Equal(core.StringPtr("my-virtual-network-interface"))) + Expect(instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP).To(Equal(virtualNetworkInterfacePrimaryIPPrototypeModel)) + Expect(instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) + Expect(instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups).To(Equal([]vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel})) + Expect(instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet).To(Equal(subnetIdentityModel)) + + // Construct an instance of the InstanceNetworkAttachmentPrototype model + instanceNetworkAttachmentPrototypeModel := new(vpcv1.InstanceNetworkAttachmentPrototype) + Expect(instanceNetworkAttachmentPrototypeModel).ToNot(BeNil()) + instanceNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-instance-network-attachment") + instanceNetworkAttachmentPrototypeModel.VirtualNetworkInterface = instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + Expect(instanceNetworkAttachmentPrototypeModel.Name).To(Equal(core.StringPtr("my-instance-network-attachment"))) + Expect(instanceNetworkAttachmentPrototypeModel.VirtualNetworkInterface).To(Equal(instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel)) + + // Construct an instance of the InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment model + instancePrototypeModel := new(vpcv1.InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment) Expect(instancePrototypeModel).ToNot(BeNil()) instancePrototypeModel.AvailabilityPolicy = instanceAvailabilityPolicyPrototypeModel instancePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel @@ -93838,6 +99668,8 @@ var _ = Describe(`VpcV1`, func() { instancePrototypeModel.NetworkInterfaces = []vpcv1.NetworkInterfacePrototype{*networkInterfacePrototypeModel} instancePrototypeModel.PrimaryNetworkInterface = networkInterfacePrototypeModel instancePrototypeModel.Zone = zoneIdentityModel + instancePrototypeModel.NetworkAttachments = []vpcv1.InstanceNetworkAttachmentPrototype{*instanceNetworkAttachmentPrototypeModel} + instancePrototypeModel.PrimaryNetworkAttachment = instanceNetworkAttachmentPrototypeModel Expect(instancePrototypeModel.AvailabilityPolicy).To(Equal(instanceAvailabilityPolicyPrototypeModel)) Expect(instancePrototypeModel.DefaultTrustedProfile).To(Equal(instanceDefaultTrustedProfilePrototypeModel)) Expect(instancePrototypeModel.Keys).To(Equal([]vpcv1.KeyIdentityIntf{keyIdentityModel})) @@ -93855,6 +99687,8 @@ var _ = Describe(`VpcV1`, func() { Expect(instancePrototypeModel.NetworkInterfaces).To(Equal([]vpcv1.NetworkInterfacePrototype{*networkInterfacePrototypeModel})) Expect(instancePrototypeModel.PrimaryNetworkInterface).To(Equal(networkInterfacePrototypeModel)) Expect(instancePrototypeModel.Zone).To(Equal(zoneIdentityModel)) + Expect(instancePrototypeModel.NetworkAttachments).To(Equal([]vpcv1.InstanceNetworkAttachmentPrototype{*instanceNetworkAttachmentPrototypeModel})) + Expect(instancePrototypeModel.PrimaryNetworkAttachment).To(Equal(instanceNetworkAttachmentPrototypeModel)) // Construct an instance of the CreateInstanceOptions model var instancePrototype vpcv1.InstancePrototypeIntf = nil @@ -94030,8 +99864,58 @@ 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 InstanceTemplatePrototypeInstanceTemplateByImage model - instanceTemplatePrototypeModel := new(vpcv1.InstanceTemplatePrototypeInstanceTemplateByImage) + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + Expect(virtualNetworkInterfaceIPPrototypeModel).ToNot(BeNil()) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + Expect(virtualNetworkInterfaceIPPrototypeModel.Address).To(Equal(core.StringPtr("10.0.0.5"))) + Expect(virtualNetworkInterfaceIPPrototypeModel.AutoDelete).To(Equal(core.BoolPtr(false))) + Expect(virtualNetworkInterfaceIPPrototypeModel.Name).To(Equal(core.StringPtr("my-reserved-ip"))) + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + Expect(virtualNetworkInterfacePrimaryIPPrototypeModel).ToNot(BeNil()) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + Expect(virtualNetworkInterfacePrimaryIPPrototypeModel.Address).To(Equal(core.StringPtr("10.0.0.5"))) + Expect(virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete).To(Equal(core.BoolPtr(false))) + Expect(virtualNetworkInterfacePrimaryIPPrototypeModel.Name).To(Equal(core.StringPtr("my-reserved-ip"))) + + // Construct an instance of the InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext model + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel := new(vpcv1.InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) + Expect(instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel).ToNot(BeNil()) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete = core.BoolPtr(false) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat = core.BoolPtr(true) + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name = core.StringPtr("my-virtual-network-interface") + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup = resourceGroupIdentityModel + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet = subnetIdentityModel + Expect(instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AllowIPSpoofing).To(Equal(core.BoolPtr(true))) + Expect(instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.AutoDelete).To(Equal(core.BoolPtr(false))) + Expect(instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.EnableInfrastructureNat).To(Equal(core.BoolPtr(true))) + Expect(instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Ips).To(Equal([]vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel})) + Expect(instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Name).To(Equal(core.StringPtr("my-virtual-network-interface"))) + Expect(instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.PrimaryIP).To(Equal(virtualNetworkInterfacePrimaryIPPrototypeModel)) + Expect(instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) + Expect(instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.SecurityGroups).To(Equal([]vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel})) + Expect(instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel.Subnet).To(Equal(subnetIdentityModel)) + + // Construct an instance of the InstanceNetworkAttachmentPrototype model + instanceNetworkAttachmentPrototypeModel := new(vpcv1.InstanceNetworkAttachmentPrototype) + Expect(instanceNetworkAttachmentPrototypeModel).ToNot(BeNil()) + instanceNetworkAttachmentPrototypeModel.Name = core.StringPtr("my-instance-network-attachment") + instanceNetworkAttachmentPrototypeModel.VirtualNetworkInterface = instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel + Expect(instanceNetworkAttachmentPrototypeModel.Name).To(Equal(core.StringPtr("my-instance-network-attachment"))) + Expect(instanceNetworkAttachmentPrototypeModel.VirtualNetworkInterface).To(Equal(instanceNetworkAttachmentPrototypeVirtualNetworkInterfaceModel)) + + // Construct an instance of the InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment model + instanceTemplatePrototypeModel := new(vpcv1.InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment) Expect(instanceTemplatePrototypeModel).ToNot(BeNil()) instanceTemplatePrototypeModel.AvailabilityPolicy = instanceAvailabilityPolicyPrototypeModel instanceTemplatePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel @@ -94050,6 +99934,8 @@ var _ = Describe(`VpcV1`, func() { instanceTemplatePrototypeModel.NetworkInterfaces = []vpcv1.NetworkInterfacePrototype{*networkInterfacePrototypeModel} instanceTemplatePrototypeModel.PrimaryNetworkInterface = networkInterfacePrototypeModel instanceTemplatePrototypeModel.Zone = zoneIdentityModel + instanceTemplatePrototypeModel.NetworkAttachments = []vpcv1.InstanceNetworkAttachmentPrototype{*instanceNetworkAttachmentPrototypeModel} + instanceTemplatePrototypeModel.PrimaryNetworkAttachment = instanceNetworkAttachmentPrototypeModel Expect(instanceTemplatePrototypeModel.AvailabilityPolicy).To(Equal(instanceAvailabilityPolicyPrototypeModel)) Expect(instanceTemplatePrototypeModel.DefaultTrustedProfile).To(Equal(instanceDefaultTrustedProfilePrototypeModel)) Expect(instanceTemplatePrototypeModel.Keys).To(Equal([]vpcv1.KeyIdentityIntf{keyIdentityModel})) @@ -94067,6 +99953,8 @@ var _ = Describe(`VpcV1`, func() { Expect(instanceTemplatePrototypeModel.NetworkInterfaces).To(Equal([]vpcv1.NetworkInterfacePrototype{*networkInterfacePrototypeModel})) Expect(instanceTemplatePrototypeModel.PrimaryNetworkInterface).To(Equal(networkInterfacePrototypeModel)) Expect(instanceTemplatePrototypeModel.Zone).To(Equal(zoneIdentityModel)) + Expect(instanceTemplatePrototypeModel.NetworkAttachments).To(Equal([]vpcv1.InstanceNetworkAttachmentPrototype{*instanceNetworkAttachmentPrototypeModel})) + Expect(instanceTemplatePrototypeModel.PrimaryNetworkAttachment).To(Equal(instanceNetworkAttachmentPrototypeModel)) // Construct an instance of the CreateInstanceTemplateOptions model var instanceTemplatePrototype vpcv1.InstanceTemplatePrototypeIntf = nil @@ -94320,12 +100208,6 @@ var _ = Describe(`VpcV1`, func() { 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 LoadBalancerLoggingDatapathPrototype model - loadBalancerLoggingDatapathPrototypeModel := new(vpcv1.LoadBalancerLoggingDatapathPrototype) - Expect(loadBalancerLoggingDatapathPrototypeModel).ToNot(BeNil()) - loadBalancerLoggingDatapathPrototypeModel.Active = core.BoolPtr(true) - Expect(loadBalancerLoggingDatapathPrototypeModel.Active).To(Equal(core.BoolPtr(true))) - // Construct an instance of the DnsInstanceIdentityByCRN model dnsInstanceIdentityModel := new(vpcv1.DnsInstanceIdentityByCRN) Expect(dnsInstanceIdentityModel).ToNot(BeNil()) @@ -94398,6 +100280,12 @@ var _ = Describe(`VpcV1`, func() { Expect(loadBalancerListenerPrototypeLoadBalancerContextModel.PortMin).To(Equal(core.Int64Ptr(int64(443)))) Expect(loadBalancerListenerPrototypeLoadBalancerContextModel.Protocol).To(Equal(core.StringPtr("http"))) + // Construct an instance of the LoadBalancerLoggingDatapathPrototype model + loadBalancerLoggingDatapathPrototypeModel := new(vpcv1.LoadBalancerLoggingDatapathPrototype) + Expect(loadBalancerLoggingDatapathPrototypeModel).ToNot(BeNil()) + loadBalancerLoggingDatapathPrototypeModel.Active = core.BoolPtr(true) + Expect(loadBalancerLoggingDatapathPrototypeModel.Active).To(Equal(core.BoolPtr(true))) + // Construct an instance of the LoadBalancerLoggingPrototype model loadBalancerLoggingPrototypeModel := new(vpcv1.LoadBalancerLoggingPrototype) Expect(loadBalancerLoggingPrototypeModel).ToNot(BeNil()) @@ -94486,7 +100374,6 @@ var _ = Describe(`VpcV1`, func() { createLoadBalancerOptionsModel := vpcService.NewCreateLoadBalancerOptions(createLoadBalancerOptionsIsPublic, createLoadBalancerOptionsSubnets) createLoadBalancerOptionsModel.SetIsPublic(true) createLoadBalancerOptionsModel.SetSubnets([]vpcv1.SubnetIdentityIntf{subnetIdentityModel}) - createLoadBalancerOptionsModel.SetDatapath(loadBalancerLoggingDatapathPrototypeModel) createLoadBalancerOptionsModel.SetDns(loadBalancerDnsPrototypeModel) createLoadBalancerOptionsModel.SetListeners([]vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext{*loadBalancerListenerPrototypeLoadBalancerContextModel}) createLoadBalancerOptionsModel.SetLogging(loadBalancerLoggingPrototypeModel) @@ -94500,7 +100387,6 @@ var _ = Describe(`VpcV1`, func() { Expect(createLoadBalancerOptionsModel).ToNot(BeNil()) Expect(createLoadBalancerOptionsModel.IsPublic).To(Equal(core.BoolPtr(true))) Expect(createLoadBalancerOptionsModel.Subnets).To(Equal([]vpcv1.SubnetIdentityIntf{subnetIdentityModel})) - Expect(createLoadBalancerOptionsModel.Datapath).To(Equal(loadBalancerLoggingDatapathPrototypeModel)) Expect(createLoadBalancerOptionsModel.Dns).To(Equal(loadBalancerDnsPrototypeModel)) Expect(createLoadBalancerOptionsModel.Listeners).To(Equal([]vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext{*loadBalancerListenerPrototypeLoadBalancerContextModel})) Expect(createLoadBalancerOptionsModel.Logging).To(Equal(loadBalancerLoggingPrototypeModel)) @@ -94867,6 +100753,16 @@ var _ = Describe(`VpcV1`, func() { Expect(createSecurityGroupTargetBindingOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewCreateShareMountTargetOptions successfully`, func() { + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + Expect(virtualNetworkInterfaceIPPrototypeModel).ToNot(BeNil()) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + Expect(virtualNetworkInterfaceIPPrototypeModel.Address).To(Equal(core.StringPtr("10.0.0.5"))) + Expect(virtualNetworkInterfaceIPPrototypeModel.AutoDelete).To(Equal(core.BoolPtr(false))) + Expect(virtualNetworkInterfaceIPPrototypeModel.Name).To(Equal(core.StringPtr("my-reserved-ip"))) + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) Expect(virtualNetworkInterfacePrimaryIPPrototypeModel).ToNot(BeNil()) @@ -94898,11 +100794,19 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model shareMountTargetVirtualNetworkInterfacePrototypeModel := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) Expect(shareMountTargetVirtualNetworkInterfacePrototypeModel).ToNot(BeNil()) + shareMountTargetVirtualNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + shareMountTargetVirtualNetworkInterfacePrototypeModel.AutoDelete = core.BoolPtr(false) + shareMountTargetVirtualNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + shareMountTargetVirtualNetworkInterfacePrototypeModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} shareMountTargetVirtualNetworkInterfacePrototypeModel.Name = core.StringPtr("my-virtual-network-interface") shareMountTargetVirtualNetworkInterfacePrototypeModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel shareMountTargetVirtualNetworkInterfacePrototypeModel.ResourceGroup = resourceGroupIdentityModel shareMountTargetVirtualNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} shareMountTargetVirtualNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + Expect(shareMountTargetVirtualNetworkInterfacePrototypeModel.AllowIPSpoofing).To(Equal(core.BoolPtr(true))) + Expect(shareMountTargetVirtualNetworkInterfacePrototypeModel.AutoDelete).To(Equal(core.BoolPtr(false))) + Expect(shareMountTargetVirtualNetworkInterfacePrototypeModel.EnableInfrastructureNat).To(Equal(core.BoolPtr(true))) + Expect(shareMountTargetVirtualNetworkInterfacePrototypeModel.Ips).To(Equal([]vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel})) Expect(shareMountTargetVirtualNetworkInterfacePrototypeModel.Name).To(Equal(core.StringPtr("my-virtual-network-interface"))) Expect(shareMountTargetVirtualNetworkInterfacePrototypeModel.PrimaryIP).To(Equal(virtualNetworkInterfacePrimaryIPPrototypeModel)) Expect(shareMountTargetVirtualNetworkInterfacePrototypeModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) @@ -94932,6 +100836,16 @@ var _ = Describe(`VpcV1`, func() { Expect(createShareMountTargetOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewCreateShareOptions successfully`, func() { + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + Expect(virtualNetworkInterfaceIPPrototypeModel).ToNot(BeNil()) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + Expect(virtualNetworkInterfaceIPPrototypeModel.Address).To(Equal(core.StringPtr("10.0.0.5"))) + Expect(virtualNetworkInterfaceIPPrototypeModel.AutoDelete).To(Equal(core.BoolPtr(false))) + Expect(virtualNetworkInterfaceIPPrototypeModel.Name).To(Equal(core.StringPtr("my-reserved-ip"))) + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) Expect(virtualNetworkInterfacePrimaryIPPrototypeModel).ToNot(BeNil()) @@ -94963,11 +100877,19 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext model shareMountTargetVirtualNetworkInterfacePrototypeModel := new(vpcv1.ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) Expect(shareMountTargetVirtualNetworkInterfacePrototypeModel).ToNot(BeNil()) + shareMountTargetVirtualNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + shareMountTargetVirtualNetworkInterfacePrototypeModel.AutoDelete = core.BoolPtr(false) + shareMountTargetVirtualNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + shareMountTargetVirtualNetworkInterfacePrototypeModel.Ips = []vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel} shareMountTargetVirtualNetworkInterfacePrototypeModel.Name = core.StringPtr("my-virtual-network-interface") shareMountTargetVirtualNetworkInterfacePrototypeModel.PrimaryIP = virtualNetworkInterfacePrimaryIPPrototypeModel shareMountTargetVirtualNetworkInterfacePrototypeModel.ResourceGroup = resourceGroupIdentityModel shareMountTargetVirtualNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} shareMountTargetVirtualNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + Expect(shareMountTargetVirtualNetworkInterfacePrototypeModel.AllowIPSpoofing).To(Equal(core.BoolPtr(true))) + Expect(shareMountTargetVirtualNetworkInterfacePrototypeModel.AutoDelete).To(Equal(core.BoolPtr(false))) + Expect(shareMountTargetVirtualNetworkInterfacePrototypeModel.EnableInfrastructureNat).To(Equal(core.BoolPtr(true))) + Expect(shareMountTargetVirtualNetworkInterfacePrototypeModel.Ips).To(Equal([]vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel})) Expect(shareMountTargetVirtualNetworkInterfacePrototypeModel.Name).To(Equal(core.StringPtr("my-virtual-network-interface"))) Expect(shareMountTargetVirtualNetworkInterfacePrototypeModel.PrimaryIP).To(Equal(virtualNetworkInterfacePrimaryIPPrototypeModel)) Expect(shareMountTargetVirtualNetworkInterfacePrototypeModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) @@ -95264,6 +101186,69 @@ var _ = Describe(`VpcV1`, func() { Expect(createSubnetReservedIPOptionsModel.Target).To(Equal(reservedIPTargetPrototypeModel)) Expect(createSubnetReservedIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewCreateVirtualNetworkInterfaceOptions successfully`, func() { + // Construct an instance of the VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext model + virtualNetworkInterfaceIPPrototypeModel := new(vpcv1.VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + Expect(virtualNetworkInterfaceIPPrototypeModel).ToNot(BeNil()) + virtualNetworkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + Expect(virtualNetworkInterfaceIPPrototypeModel.Address).To(Equal(core.StringPtr("10.0.0.5"))) + Expect(virtualNetworkInterfaceIPPrototypeModel.AutoDelete).To(Equal(core.BoolPtr(false))) + Expect(virtualNetworkInterfaceIPPrototypeModel.Name).To(Equal(core.StringPtr("my-reserved-ip"))) + + // Construct an instance of the VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext model + virtualNetworkInterfacePrimaryIPPrototypeModel := new(vpcv1.VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + Expect(virtualNetworkInterfacePrimaryIPPrototypeModel).ToNot(BeNil()) + virtualNetworkInterfacePrimaryIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete = core.BoolPtr(false) + virtualNetworkInterfacePrimaryIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + Expect(virtualNetworkInterfacePrimaryIPPrototypeModel.Address).To(Equal(core.StringPtr("10.0.0.5"))) + Expect(virtualNetworkInterfacePrimaryIPPrototypeModel.AutoDelete).To(Equal(core.BoolPtr(false))) + Expect(virtualNetworkInterfacePrimaryIPPrototypeModel.Name).To(Equal(core.StringPtr("my-reserved-ip"))) + + // 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 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 CreateVirtualNetworkInterfaceOptions model + createVirtualNetworkInterfaceOptionsModel := vpcService.NewCreateVirtualNetworkInterfaceOptions() + createVirtualNetworkInterfaceOptionsModel.SetAllowIPSpoofing(true) + createVirtualNetworkInterfaceOptionsModel.SetAutoDelete(false) + createVirtualNetworkInterfaceOptionsModel.SetEnableInfrastructureNat(true) + createVirtualNetworkInterfaceOptionsModel.SetIps([]vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel}) + createVirtualNetworkInterfaceOptionsModel.SetName("my-virtual-network-interface") + createVirtualNetworkInterfaceOptionsModel.SetPrimaryIP(virtualNetworkInterfacePrimaryIPPrototypeModel) + createVirtualNetworkInterfaceOptionsModel.SetResourceGroup(resourceGroupIdentityModel) + createVirtualNetworkInterfaceOptionsModel.SetSecurityGroups([]vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel}) + createVirtualNetworkInterfaceOptionsModel.SetSubnet(subnetIdentityModel) + createVirtualNetworkInterfaceOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createVirtualNetworkInterfaceOptionsModel).ToNot(BeNil()) + Expect(createVirtualNetworkInterfaceOptionsModel.AllowIPSpoofing).To(Equal(core.BoolPtr(true))) + Expect(createVirtualNetworkInterfaceOptionsModel.AutoDelete).To(Equal(core.BoolPtr(false))) + Expect(createVirtualNetworkInterfaceOptionsModel.EnableInfrastructureNat).To(Equal(core.BoolPtr(true))) + Expect(createVirtualNetworkInterfaceOptionsModel.Ips).To(Equal([]vpcv1.VirtualNetworkInterfaceIPPrototypeIntf{virtualNetworkInterfaceIPPrototypeModel})) + Expect(createVirtualNetworkInterfaceOptionsModel.Name).To(Equal(core.StringPtr("my-virtual-network-interface"))) + Expect(createVirtualNetworkInterfaceOptionsModel.PrimaryIP).To(Equal(virtualNetworkInterfacePrimaryIPPrototypeModel)) + Expect(createVirtualNetworkInterfaceOptionsModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) + Expect(createVirtualNetworkInterfaceOptionsModel.SecurityGroups).To(Equal([]vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel})) + Expect(createVirtualNetworkInterfaceOptionsModel.Subnet).To(Equal(subnetIdentityModel)) + Expect(createVirtualNetworkInterfaceOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewCreateVolumeOptions successfully`, func() { // Construct an instance of the VolumeProfileIdentityByName model volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) @@ -95440,6 +101425,7 @@ var _ = Describe(`VpcV1`, func() { createVPCRouteOptionsModel.SetDestination("192.168.3.0/24") createVPCRouteOptionsModel.SetZone(zoneIdentityModel) createVPCRouteOptionsModel.SetAction("deliver") + createVPCRouteOptionsModel.SetAdvertise(false) createVPCRouteOptionsModel.SetName("my-route-1") createVPCRouteOptionsModel.SetNextHop(routePrototypeNextHopModel) createVPCRouteOptionsModel.SetPriority(int64(1)) @@ -95449,6 +101435,7 @@ var _ = Describe(`VpcV1`, func() { 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.Advertise).To(Equal(core.BoolPtr(false))) Expect(createVPCRouteOptionsModel.Name).To(Equal(core.StringPtr("my-route-1"))) Expect(createVPCRouteOptionsModel.NextHop).To(Equal(routePrototypeNextHopModel)) Expect(createVPCRouteOptionsModel.Priority).To(Equal(core.Int64Ptr(int64(1)))) @@ -95477,12 +101464,14 @@ var _ = Describe(`VpcV1`, func() { routePrototypeModel := new(vpcv1.RoutePrototype) Expect(routePrototypeModel).ToNot(BeNil()) routePrototypeModel.Action = core.StringPtr("deliver") + routePrototypeModel.Advertise = core.BoolPtr(false) routePrototypeModel.Destination = core.StringPtr("192.168.3.0/24") routePrototypeModel.Name = core.StringPtr("my-route-1") routePrototypeModel.NextHop = routePrototypeNextHopModel routePrototypeModel.Priority = core.Int64Ptr(int64(1)) routePrototypeModel.Zone = zoneIdentityModel Expect(routePrototypeModel.Action).To(Equal(core.StringPtr("deliver"))) + Expect(routePrototypeModel.Advertise).To(Equal(core.BoolPtr(false))) Expect(routePrototypeModel.Destination).To(Equal(core.StringPtr("192.168.3.0/24"))) Expect(routePrototypeModel.Name).To(Equal(core.StringPtr("my-route-1"))) Expect(routePrototypeModel.NextHop).To(Equal(routePrototypeNextHopModel)) @@ -95494,6 +101483,7 @@ var _ = Describe(`VpcV1`, func() { createVPCRoutingTableOptionsModel := vpcService.NewCreateVPCRoutingTableOptions(vpcID) createVPCRoutingTableOptionsModel.SetVPCID("testString") createVPCRoutingTableOptionsModel.SetAcceptRoutesFrom([]vpcv1.ResourceFilter{*resourceFilterModel}) + createVPCRoutingTableOptionsModel.SetAdvertiseRoutesTo([]string{}) createVPCRoutingTableOptionsModel.SetName("my-routing-table-1") createVPCRoutingTableOptionsModel.SetRouteDirectLinkIngress(false) createVPCRoutingTableOptionsModel.SetRouteInternetIngress(false) @@ -95504,6 +101494,7 @@ var _ = Describe(`VpcV1`, func() { Expect(createVPCRoutingTableOptionsModel).ToNot(BeNil()) Expect(createVPCRoutingTableOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) Expect(createVPCRoutingTableOptionsModel.AcceptRoutesFrom).To(Equal([]vpcv1.ResourceFilter{*resourceFilterModel})) + Expect(createVPCRoutingTableOptionsModel.AdvertiseRoutesTo).To(Equal([]string{})) Expect(createVPCRoutingTableOptionsModel.Name).To(Equal(core.StringPtr("my-routing-table-1"))) Expect(createVPCRoutingTableOptionsModel.RouteDirectLinkIngress).To(Equal(core.BoolPtr(false))) Expect(createVPCRoutingTableOptionsModel.RouteInternetIngress).To(Equal(core.BoolPtr(false))) @@ -95536,6 +101527,7 @@ var _ = Describe(`VpcV1`, func() { createVPCRoutingTableRouteOptionsModel.SetDestination("192.168.3.0/24") createVPCRoutingTableRouteOptionsModel.SetZone(zoneIdentityModel) createVPCRoutingTableRouteOptionsModel.SetAction("deliver") + createVPCRoutingTableRouteOptionsModel.SetAdvertise(false) createVPCRoutingTableRouteOptionsModel.SetName("my-route-1") createVPCRoutingTableRouteOptionsModel.SetNextHop(routePrototypeNextHopModel) createVPCRoutingTableRouteOptionsModel.SetPriority(int64(1)) @@ -95546,6 +101538,7 @@ 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.Advertise).To(Equal(core.BoolPtr(false))) Expect(createVPCRoutingTableRouteOptionsModel.Name).To(Equal(core.StringPtr("my-route-1"))) Expect(createVPCRoutingTableRouteOptionsModel.NextHop).To(Equal(routePrototypeNextHopModel)) Expect(createVPCRoutingTableRouteOptionsModel.Priority).To(Equal(core.Int64Ptr(int64(1)))) @@ -95769,6 +101762,19 @@ var _ = Describe(`VpcV1`, func() { Expect(deleteBackupPolicyPlanOptionsModel.IfMatch).To(Equal(core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) Expect(deleteBackupPolicyPlanOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewDeleteBareMetalServerNetworkAttachmentOptions successfully`, func() { + // Construct an instance of the DeleteBareMetalServerNetworkAttachmentOptions model + bareMetalServerID := "testString" + id := "testString" + deleteBareMetalServerNetworkAttachmentOptionsModel := vpcService.NewDeleteBareMetalServerNetworkAttachmentOptions(bareMetalServerID, id) + deleteBareMetalServerNetworkAttachmentOptionsModel.SetBareMetalServerID("testString") + deleteBareMetalServerNetworkAttachmentOptionsModel.SetID("testString") + deleteBareMetalServerNetworkAttachmentOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteBareMetalServerNetworkAttachmentOptionsModel).ToNot(BeNil()) + Expect(deleteBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID).To(Equal(core.StringPtr("testString"))) + Expect(deleteBareMetalServerNetworkAttachmentOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteBareMetalServerNetworkAttachmentOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewDeleteBareMetalServerNetworkInterfaceOptions successfully`, func() { // Construct an instance of the DeleteBareMetalServerNetworkInterfaceOptions model bareMetalServerID := "testString" @@ -95963,6 +101969,19 @@ var _ = Describe(`VpcV1`, func() { Expect(deleteInstanceGroupOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(deleteInstanceGroupOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewDeleteInstanceNetworkAttachmentOptions successfully`, func() { + // Construct an instance of the DeleteInstanceNetworkAttachmentOptions model + instanceID := "testString" + id := "testString" + deleteInstanceNetworkAttachmentOptionsModel := vpcService.NewDeleteInstanceNetworkAttachmentOptions(instanceID, id) + deleteInstanceNetworkAttachmentOptionsModel.SetInstanceID("testString") + deleteInstanceNetworkAttachmentOptionsModel.SetID("testString") + deleteInstanceNetworkAttachmentOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteInstanceNetworkAttachmentOptionsModel).ToNot(BeNil()) + Expect(deleteInstanceNetworkAttachmentOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) + Expect(deleteInstanceNetworkAttachmentOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteInstanceNetworkAttachmentOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewDeleteInstanceNetworkInterfaceOptions successfully`, func() { // Construct an instance of the DeleteInstanceNetworkInterfaceOptions model instanceID := "testString" @@ -96300,6 +102319,16 @@ var _ = Describe(`VpcV1`, func() { Expect(deleteSubnetReservedIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(deleteSubnetReservedIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewDeleteVirtualNetworkInterfacesOptions successfully`, func() { + // Construct an instance of the DeleteVirtualNetworkInterfacesOptions model + id := "testString" + deleteVirtualNetworkInterfacesOptionsModel := vpcService.NewDeleteVirtualNetworkInterfacesOptions(id) + deleteVirtualNetworkInterfacesOptionsModel.SetID("testString") + deleteVirtualNetworkInterfacesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteVirtualNetworkInterfacesOptionsModel).ToNot(BeNil()) + Expect(deleteVirtualNetworkInterfacesOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteVirtualNetworkInterfacesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewDeleteVolumeOptions successfully`, func() { // Construct an instance of the DeleteVolumeOptions model id := "testString" @@ -96551,6 +102580,19 @@ var _ = Describe(`VpcV1`, func() { Expect(getBareMetalServerInitializationOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(getBareMetalServerInitializationOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewGetBareMetalServerNetworkAttachmentOptions successfully`, func() { + // Construct an instance of the GetBareMetalServerNetworkAttachmentOptions model + bareMetalServerID := "testString" + id := "testString" + getBareMetalServerNetworkAttachmentOptionsModel := vpcService.NewGetBareMetalServerNetworkAttachmentOptions(bareMetalServerID, id) + getBareMetalServerNetworkAttachmentOptionsModel.SetBareMetalServerID("testString") + getBareMetalServerNetworkAttachmentOptionsModel.SetID("testString") + getBareMetalServerNetworkAttachmentOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getBareMetalServerNetworkAttachmentOptionsModel).ToNot(BeNil()) + Expect(getBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID).To(Equal(core.StringPtr("testString"))) + Expect(getBareMetalServerNetworkAttachmentOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getBareMetalServerNetworkAttachmentOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewGetBareMetalServerNetworkInterfaceFloatingIPOptions successfully`, func() { // Construct an instance of the GetBareMetalServerNetworkInterfaceFloatingIPOptions model bareMetalServerID := "testString" @@ -96826,6 +102868,19 @@ var _ = Describe(`VpcV1`, func() { Expect(getInstanceInitializationOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(getInstanceInitializationOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewGetInstanceNetworkAttachmentOptions successfully`, func() { + // Construct an instance of the GetInstanceNetworkAttachmentOptions model + instanceID := "testString" + id := "testString" + getInstanceNetworkAttachmentOptionsModel := vpcService.NewGetInstanceNetworkAttachmentOptions(instanceID, id) + getInstanceNetworkAttachmentOptionsModel.SetInstanceID("testString") + getInstanceNetworkAttachmentOptionsModel.SetID("testString") + getInstanceNetworkAttachmentOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getInstanceNetworkAttachmentOptionsModel).ToNot(BeNil()) + Expect(getInstanceNetworkAttachmentOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) + Expect(getInstanceNetworkAttachmentOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getInstanceNetworkAttachmentOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewGetInstanceNetworkInterfaceFloatingIPOptions successfully`, func() { // Construct an instance of the GetInstanceNetworkInterfaceFloatingIPOptions model instanceID := "testString" @@ -97064,6 +103119,19 @@ var _ = Describe(`VpcV1`, func() { Expect(getNetworkACLRuleOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(getNetworkACLRuleOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewGetNetworkInterfaceFloatingIPOptions successfully`, func() { + // Construct an instance of the GetNetworkInterfaceFloatingIPOptions model + virtualNetworkInterfaceID := "testString" + id := "testString" + getNetworkInterfaceFloatingIPOptionsModel := vpcService.NewGetNetworkInterfaceFloatingIPOptions(virtualNetworkInterfaceID, id) + getNetworkInterfaceFloatingIPOptionsModel.SetVirtualNetworkInterfaceID("testString") + getNetworkInterfaceFloatingIPOptionsModel.SetID("testString") + getNetworkInterfaceFloatingIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getNetworkInterfaceFloatingIPOptionsModel).ToNot(BeNil()) + Expect(getNetworkInterfaceFloatingIPOptionsModel.VirtualNetworkInterfaceID).To(Equal(core.StringPtr("testString"))) + Expect(getNetworkInterfaceFloatingIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getNetworkInterfaceFloatingIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewGetOperatingSystemOptions successfully`, func() { // Construct an instance of the GetOperatingSystemOptions model name := "testString" @@ -97282,6 +103350,19 @@ var _ = Describe(`VpcV1`, func() { Expect(getSubnetRoutingTableOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(getSubnetRoutingTableOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewGetVirtualNetworkInterfaceIPOptions successfully`, func() { + // Construct an instance of the GetVirtualNetworkInterfaceIPOptions model + virtualNetworkInterfaceID := "testString" + id := "testString" + getVirtualNetworkInterfaceIPOptionsModel := vpcService.NewGetVirtualNetworkInterfaceIPOptions(virtualNetworkInterfaceID, id) + getVirtualNetworkInterfaceIPOptionsModel.SetVirtualNetworkInterfaceID("testString") + getVirtualNetworkInterfaceIPOptionsModel.SetID("testString") + getVirtualNetworkInterfaceIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getVirtualNetworkInterfaceIPOptionsModel).ToNot(BeNil()) + Expect(getVirtualNetworkInterfaceIPOptionsModel.VirtualNetworkInterfaceID).To(Equal(core.StringPtr("testString"))) + Expect(getVirtualNetworkInterfaceIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getVirtualNetworkInterfaceIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewGetVirtualNetworkInterfaceOptions successfully`, func() { // Construct an instance of the GetVirtualNetworkInterfaceOptions model id := "testString" @@ -97512,6 +103593,11 @@ var _ = Describe(`VpcV1`, func() { Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) + It(`Invoke NewInstanceNetworkAttachmentPrototype successfully`, func() { + var virtualNetworkInterface vpcv1.InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf = nil + _, err := vpcService.NewInstanceNetworkAttachmentPrototype(virtualNetworkInterface) + Expect(err).ToNot(BeNil()) + }) It(`Invoke NewListBackupPoliciesOptions successfully`, func() { // Construct an instance of the ListBackupPoliciesOptions model listBackupPoliciesOptionsModel := vpcService.NewListBackupPoliciesOptions() @@ -97577,6 +103663,20 @@ var _ = Describe(`VpcV1`, func() { Expect(listBareMetalServerDisksOptionsModel.BareMetalServerID).To(Equal(core.StringPtr("testString"))) Expect(listBareMetalServerDisksOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewListBareMetalServerNetworkAttachmentsOptions successfully`, func() { + // Construct an instance of the ListBareMetalServerNetworkAttachmentsOptions model + bareMetalServerID := "testString" + listBareMetalServerNetworkAttachmentsOptionsModel := vpcService.NewListBareMetalServerNetworkAttachmentsOptions(bareMetalServerID) + listBareMetalServerNetworkAttachmentsOptionsModel.SetBareMetalServerID("testString") + listBareMetalServerNetworkAttachmentsOptionsModel.SetStart("testString") + listBareMetalServerNetworkAttachmentsOptionsModel.SetLimit(int64(10)) + listBareMetalServerNetworkAttachmentsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listBareMetalServerNetworkAttachmentsOptionsModel).ToNot(BeNil()) + Expect(listBareMetalServerNetworkAttachmentsOptionsModel.BareMetalServerID).To(Equal(core.StringPtr("testString"))) + Expect(listBareMetalServerNetworkAttachmentsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listBareMetalServerNetworkAttachmentsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) + Expect(listBareMetalServerNetworkAttachmentsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewListBareMetalServerNetworkInterfaceFloatingIpsOptions successfully`, func() { // Construct an instance of the ListBareMetalServerNetworkInterfaceFloatingIpsOptions model bareMetalServerID := "testString" @@ -97752,12 +103852,20 @@ var _ = Describe(`VpcV1`, func() { listFloatingIpsOptionsModel.SetLimit(int64(10)) listFloatingIpsOptionsModel.SetResourceGroupID("testString") listFloatingIpsOptionsModel.SetSort("name") + listFloatingIpsOptionsModel.SetTargetID("testString") + listFloatingIpsOptionsModel.SetTargetCRN("crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727") + listFloatingIpsOptionsModel.SetTargetName("my-resource") + listFloatingIpsOptionsModel.SetTargetResourceType("testString") listFloatingIpsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listFloatingIpsOptionsModel).ToNot(BeNil()) Expect(listFloatingIpsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) Expect(listFloatingIpsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listFloatingIpsOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) Expect(listFloatingIpsOptionsModel.Sort).To(Equal(core.StringPtr("name"))) + Expect(listFloatingIpsOptionsModel.TargetID).To(Equal(core.StringPtr("testString"))) + Expect(listFloatingIpsOptionsModel.TargetCRN).To(Equal(core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727"))) + Expect(listFloatingIpsOptionsModel.TargetName).To(Equal(core.StringPtr("my-resource"))) + Expect(listFloatingIpsOptionsModel.TargetResourceType).To(Equal(core.StringPtr("testString"))) Expect(listFloatingIpsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewListFlowLogCollectorsOptions successfully`, func() { @@ -97920,6 +104028,16 @@ var _ = Describe(`VpcV1`, func() { Expect(listInstanceGroupsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listInstanceGroupsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewListInstanceNetworkAttachmentsOptions successfully`, func() { + // Construct an instance of the ListInstanceNetworkAttachmentsOptions model + instanceID := "testString" + listInstanceNetworkAttachmentsOptionsModel := vpcService.NewListInstanceNetworkAttachmentsOptions(instanceID) + listInstanceNetworkAttachmentsOptionsModel.SetInstanceID("testString") + listInstanceNetworkAttachmentsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listInstanceNetworkAttachmentsOptionsModel).ToNot(BeNil()) + Expect(listInstanceNetworkAttachmentsOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) + Expect(listInstanceNetworkAttachmentsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewListInstanceNetworkInterfaceFloatingIpsOptions successfully`, func() { // Construct an instance of the ListInstanceNetworkInterfaceFloatingIpsOptions model instanceID := "testString" @@ -98162,6 +104280,22 @@ var _ = Describe(`VpcV1`, func() { Expect(listNetworkAclsOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) Expect(listNetworkAclsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewListNetworkInterfaceFloatingIpsOptions successfully`, func() { + // Construct an instance of the ListNetworkInterfaceFloatingIpsOptions model + virtualNetworkInterfaceID := "testString" + listNetworkInterfaceFloatingIpsOptionsModel := vpcService.NewListNetworkInterfaceFloatingIpsOptions(virtualNetworkInterfaceID) + listNetworkInterfaceFloatingIpsOptionsModel.SetVirtualNetworkInterfaceID("testString") + listNetworkInterfaceFloatingIpsOptionsModel.SetStart("testString") + listNetworkInterfaceFloatingIpsOptionsModel.SetLimit(int64(10)) + listNetworkInterfaceFloatingIpsOptionsModel.SetSort("name") + listNetworkInterfaceFloatingIpsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listNetworkInterfaceFloatingIpsOptionsModel).ToNot(BeNil()) + Expect(listNetworkInterfaceFloatingIpsOptionsModel.VirtualNetworkInterfaceID).To(Equal(core.StringPtr("testString"))) + Expect(listNetworkInterfaceFloatingIpsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listNetworkInterfaceFloatingIpsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) + Expect(listNetworkInterfaceFloatingIpsOptionsModel.Sort).To(Equal(core.StringPtr("name"))) + Expect(listNetworkInterfaceFloatingIpsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewListOperatingSystemsOptions successfully`, func() { // Construct an instance of the ListOperatingSystemsOptions model listOperatingSystemsOptionsModel := vpcService.NewListOperatingSystemsOptions() @@ -98393,12 +104527,20 @@ var _ = Describe(`VpcV1`, func() { listSubnetReservedIpsOptionsModel.SetStart("testString") listSubnetReservedIpsOptionsModel.SetLimit(int64(10)) listSubnetReservedIpsOptionsModel.SetSort("name") + listSubnetReservedIpsOptionsModel.SetTargetID("testString") + listSubnetReservedIpsOptionsModel.SetTargetCRN("crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727") + listSubnetReservedIpsOptionsModel.SetTargetName("my-resource") + listSubnetReservedIpsOptionsModel.SetTargetResourceType("testString") listSubnetReservedIpsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listSubnetReservedIpsOptionsModel).ToNot(BeNil()) Expect(listSubnetReservedIpsOptionsModel.SubnetID).To(Equal(core.StringPtr("testString"))) Expect(listSubnetReservedIpsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) Expect(listSubnetReservedIpsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listSubnetReservedIpsOptionsModel.Sort).To(Equal(core.StringPtr("name"))) + Expect(listSubnetReservedIpsOptionsModel.TargetID).To(Equal(core.StringPtr("testString"))) + Expect(listSubnetReservedIpsOptionsModel.TargetCRN).To(Equal(core.StringPtr("crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727"))) + Expect(listSubnetReservedIpsOptionsModel.TargetName).To(Equal(core.StringPtr("my-resource"))) + Expect(listSubnetReservedIpsOptionsModel.TargetResourceType).To(Equal(core.StringPtr("testString"))) Expect(listSubnetReservedIpsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewListSubnetsOptions successfully`, func() { @@ -98426,6 +104568,22 @@ var _ = Describe(`VpcV1`, func() { Expect(listSubnetsOptionsModel.RoutingTableName).To(Equal(core.StringPtr("my-routing-table"))) Expect(listSubnetsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewListVirtualNetworkInterfaceIpsOptions successfully`, func() { + // Construct an instance of the ListVirtualNetworkInterfaceIpsOptions model + virtualNetworkInterfaceID := "testString" + listVirtualNetworkInterfaceIpsOptionsModel := vpcService.NewListVirtualNetworkInterfaceIpsOptions(virtualNetworkInterfaceID) + listVirtualNetworkInterfaceIpsOptionsModel.SetVirtualNetworkInterfaceID("testString") + listVirtualNetworkInterfaceIpsOptionsModel.SetStart("testString") + listVirtualNetworkInterfaceIpsOptionsModel.SetLimit(int64(10)) + listVirtualNetworkInterfaceIpsOptionsModel.SetSort("name") + listVirtualNetworkInterfaceIpsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listVirtualNetworkInterfaceIpsOptionsModel).ToNot(BeNil()) + Expect(listVirtualNetworkInterfaceIpsOptionsModel.VirtualNetworkInterfaceID).To(Equal(core.StringPtr("testString"))) + Expect(listVirtualNetworkInterfaceIpsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listVirtualNetworkInterfaceIpsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) + Expect(listVirtualNetworkInterfaceIpsOptionsModel.Sort).To(Equal(core.StringPtr("name"))) + Expect(listVirtualNetworkInterfaceIpsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewListVirtualNetworkInterfacesOptions successfully`, func() { // Construct an instance of the ListVirtualNetworkInterfacesOptions model listVirtualNetworkInterfacesOptionsModel := vpcService.NewListVirtualNetworkInterfacesOptions() @@ -98815,6 +104973,32 @@ var _ = Describe(`VpcV1`, func() { Expect(removeInstanceNetworkInterfaceFloatingIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(removeInstanceNetworkInterfaceFloatingIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewRemoveNetworkInterfaceFloatingIPOptions successfully`, func() { + // Construct an instance of the RemoveNetworkInterfaceFloatingIPOptions model + virtualNetworkInterfaceID := "testString" + id := "testString" + removeNetworkInterfaceFloatingIPOptionsModel := vpcService.NewRemoveNetworkInterfaceFloatingIPOptions(virtualNetworkInterfaceID, id) + removeNetworkInterfaceFloatingIPOptionsModel.SetVirtualNetworkInterfaceID("testString") + removeNetworkInterfaceFloatingIPOptionsModel.SetID("testString") + removeNetworkInterfaceFloatingIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(removeNetworkInterfaceFloatingIPOptionsModel).ToNot(BeNil()) + Expect(removeNetworkInterfaceFloatingIPOptionsModel.VirtualNetworkInterfaceID).To(Equal(core.StringPtr("testString"))) + Expect(removeNetworkInterfaceFloatingIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(removeNetworkInterfaceFloatingIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewRemoveVirtualNetworkInterfaceIPOptions successfully`, func() { + // Construct an instance of the RemoveVirtualNetworkInterfaceIPOptions model + virtualNetworkInterfaceID := "testString" + id := "testString" + removeVirtualNetworkInterfaceIPOptionsModel := vpcService.NewRemoveVirtualNetworkInterfaceIPOptions(virtualNetworkInterfaceID, id) + removeVirtualNetworkInterfaceIPOptionsModel.SetVirtualNetworkInterfaceID("testString") + removeVirtualNetworkInterfaceIPOptionsModel.SetID("testString") + removeVirtualNetworkInterfaceIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(removeVirtualNetworkInterfaceIPOptionsModel).ToNot(BeNil()) + Expect(removeVirtualNetworkInterfaceIPOptionsModel.VirtualNetworkInterfaceID).To(Equal(core.StringPtr("testString"))) + Expect(removeVirtualNetworkInterfaceIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(removeVirtualNetworkInterfaceIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewRemoveVPNGatewayConnectionLocalCIDROptions successfully`, func() { // Construct an instance of the RemoveVPNGatewayConnectionLocalCIDROptions model vpnGatewayID := "testString" @@ -99062,6 +105246,22 @@ var _ = Describe(`VpcV1`, func() { Expect(updateBareMetalServerDiskOptionsModel.BareMetalServerDiskPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateBareMetalServerDiskOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewUpdateBareMetalServerNetworkAttachmentOptions successfully`, func() { + // Construct an instance of the UpdateBareMetalServerNetworkAttachmentOptions model + bareMetalServerID := "testString" + id := "testString" + bareMetalServerNetworkAttachmentPatch := map[string]interface{}{"anyKey": "anyValue"} + updateBareMetalServerNetworkAttachmentOptionsModel := vpcService.NewUpdateBareMetalServerNetworkAttachmentOptions(bareMetalServerID, id, bareMetalServerNetworkAttachmentPatch) + updateBareMetalServerNetworkAttachmentOptionsModel.SetBareMetalServerID("testString") + updateBareMetalServerNetworkAttachmentOptionsModel.SetID("testString") + updateBareMetalServerNetworkAttachmentOptionsModel.SetBareMetalServerNetworkAttachmentPatch(map[string]interface{}{"anyKey": "anyValue"}) + updateBareMetalServerNetworkAttachmentOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateBareMetalServerNetworkAttachmentOptionsModel).ToNot(BeNil()) + Expect(updateBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerID).To(Equal(core.StringPtr("testString"))) + Expect(updateBareMetalServerNetworkAttachmentOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateBareMetalServerNetworkAttachmentOptionsModel.BareMetalServerNetworkAttachmentPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) + Expect(updateBareMetalServerNetworkAttachmentOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewUpdateBareMetalServerNetworkInterfaceOptions successfully`, func() { // Construct an instance of the UpdateBareMetalServerNetworkInterfaceOptions model bareMetalServerID := "testString" @@ -99313,6 +105513,22 @@ var _ = Describe(`VpcV1`, func() { Expect(updateInstanceGroupOptionsModel.InstanceGroupPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateInstanceGroupOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewUpdateInstanceNetworkAttachmentOptions successfully`, func() { + // Construct an instance of the UpdateInstanceNetworkAttachmentOptions model + instanceID := "testString" + id := "testString" + instanceNetworkAttachmentPatch := map[string]interface{}{"anyKey": "anyValue"} + updateInstanceNetworkAttachmentOptionsModel := vpcService.NewUpdateInstanceNetworkAttachmentOptions(instanceID, id, instanceNetworkAttachmentPatch) + updateInstanceNetworkAttachmentOptionsModel.SetInstanceID("testString") + updateInstanceNetworkAttachmentOptionsModel.SetID("testString") + updateInstanceNetworkAttachmentOptionsModel.SetInstanceNetworkAttachmentPatch(map[string]interface{}{"anyKey": "anyValue"}) + updateInstanceNetworkAttachmentOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateInstanceNetworkAttachmentOptionsModel).ToNot(BeNil()) + Expect(updateInstanceNetworkAttachmentOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) + Expect(updateInstanceNetworkAttachmentOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateInstanceNetworkAttachmentOptionsModel.InstanceNetworkAttachmentPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) + Expect(updateInstanceNetworkAttachmentOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewUpdateInstanceNetworkInterfaceOptions successfully`, func() { // Construct an instance of the UpdateInstanceNetworkInterfaceOptions model instanceID := "testString" @@ -99911,6 +106127,19 @@ var _ = Describe(`VpcV1`, func() { Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) + It(`Invoke NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype successfully`, func() { + var virtualNetworkInterface vpcv1.BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf = nil + interfaceType := "pci" + _, err := vpcService.NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype(virtualNetworkInterface, interfaceType) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype successfully`, func() { + var virtualNetworkInterface vpcv1.BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf = nil + interfaceType := "vlan" + vlan := int64(4) + _, err := vpcService.NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype(virtualNetworkInterface, interfaceType, vlan) + Expect(err).ToNot(BeNil()) + }) It(`Invoke NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype successfully`, func() { var subnet vpcv1.SubnetIdentityIntf = nil interfaceType := "hipersocket" @@ -99930,6 +106159,11 @@ var _ = Describe(`VpcV1`, func() { _, err := vpcService.NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype(subnet, interfaceType, vlan) Expect(err).ToNot(BeNil()) }) + It(`Invoke NewBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype successfully`, func() { + var virtualNetworkInterface vpcv1.BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf = nil + _, err := vpcService.NewBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype(virtualNetworkInterface) + Expect(err).ToNot(BeNil()) + }) It(`Invoke NewBareMetalServerProfileIdentityByHref successfully`, func() { href := "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768" _model, err := vpcService.NewBareMetalServerProfileIdentityByHref(href) @@ -99942,6 +106176,22 @@ var _ = Describe(`VpcV1`, func() { Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) + It(`Invoke NewBareMetalServerPrototypeBareMetalServerByNetworkAttachment successfully`, func() { + var initialization *vpcv1.BareMetalServerInitializationPrototype = nil + var profile vpcv1.BareMetalServerProfileIdentityIntf = nil + var zone vpcv1.ZoneIdentityIntf = nil + var primaryNetworkAttachment vpcv1.BareMetalServerPrimaryNetworkAttachmentPrototypeIntf = nil + _, err := vpcService.NewBareMetalServerPrototypeBareMetalServerByNetworkAttachment(initialization, profile, zone, primaryNetworkAttachment) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewBareMetalServerPrototypeBareMetalServerByNetworkInterface successfully`, func() { + var initialization *vpcv1.BareMetalServerInitializationPrototype = nil + var profile vpcv1.BareMetalServerProfileIdentityIntf = nil + var zone vpcv1.ZoneIdentityIntf = nil + var primaryNetworkInterface *vpcv1.BareMetalServerPrimaryNetworkInterfacePrototype = nil + _, err := vpcService.NewBareMetalServerPrototypeBareMetalServerByNetworkInterface(initialization, profile, zone, primaryNetworkInterface) + Expect(err).ToNot(BeNil()) + }) It(`Invoke NewCatalogOfferingIdentityCatalogOfferingByCRN successfully`, func() { crn := "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:offering:00111601-0ec5-41ac-b142-96d1e64e6442" _model, err := vpcService.NewCatalogOfferingIdentityCatalogOfferingByCRN(crn) @@ -100131,39 +106381,11 @@ var _ = Describe(`VpcV1`, func() { Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) - It(`Invoke NewInstancePrototypeInstanceByCatalogOffering successfully`, func() { - var catalogOffering vpcv1.InstanceCatalogOfferingPrototypeIntf = nil - var primaryNetworkInterface *vpcv1.NetworkInterfacePrototype = nil - var zone vpcv1.ZoneIdentityIntf = nil - _, err := vpcService.NewInstancePrototypeInstanceByCatalogOffering(catalogOffering, primaryNetworkInterface, zone) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewInstancePrototypeInstanceByImage successfully`, func() { - var image vpcv1.ImageIdentityIntf = nil - var primaryNetworkInterface *vpcv1.NetworkInterfacePrototype = nil - var zone vpcv1.ZoneIdentityIntf = nil - _, err := vpcService.NewInstancePrototypeInstanceByImage(image, primaryNetworkInterface, zone) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewInstancePrototypeInstanceBySourceSnapshot successfully`, func() { - var bootVolumeAttachment *vpcv1.VolumeAttachmentPrototypeInstanceBySourceSnapshotContext = nil - var primaryNetworkInterface *vpcv1.NetworkInterfacePrototype = nil - var zone vpcv1.ZoneIdentityIntf = nil - _, err := vpcService.NewInstancePrototypeInstanceBySourceSnapshot(bootVolumeAttachment, primaryNetworkInterface, zone) - Expect(err).ToNot(BeNil()) - }) It(`Invoke NewInstancePrototypeInstanceBySourceTemplate successfully`, func() { var sourceTemplate vpcv1.InstanceTemplateIdentityIntf = nil _, err := vpcService.NewInstancePrototypeInstanceBySourceTemplate(sourceTemplate) Expect(err).ToNot(BeNil()) }) - It(`Invoke NewInstancePrototypeInstanceByVolume successfully`, func() { - var bootVolumeAttachment *vpcv1.VolumeAttachmentPrototypeInstanceByVolumeContext = nil - var primaryNetworkInterface *vpcv1.NetworkInterfacePrototype = nil - var zone vpcv1.ZoneIdentityIntf = nil - _, err := vpcService.NewInstancePrototypeInstanceByVolume(bootVolumeAttachment, primaryNetworkInterface, zone) - Expect(err).ToNot(BeNil()) - }) It(`Invoke NewInstanceTemplateIdentityByCRN successfully`, func() { crn := "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a" _model, err := vpcService.NewInstanceTemplateIdentityByCRN(crn) @@ -100182,27 +106404,6 @@ var _ = Describe(`VpcV1`, func() { Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) - It(`Invoke NewInstanceTemplatePrototypeInstanceTemplateByCatalogOffering successfully`, func() { - var catalogOffering vpcv1.InstanceCatalogOfferingPrototypeIntf = nil - var primaryNetworkInterface *vpcv1.NetworkInterfacePrototype = nil - var zone vpcv1.ZoneIdentityIntf = nil - _, err := vpcService.NewInstanceTemplatePrototypeInstanceTemplateByCatalogOffering(catalogOffering, primaryNetworkInterface, zone) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewInstanceTemplatePrototypeInstanceTemplateByImage successfully`, func() { - var image vpcv1.ImageIdentityIntf = nil - var primaryNetworkInterface *vpcv1.NetworkInterfacePrototype = nil - var zone vpcv1.ZoneIdentityIntf = nil - _, err := vpcService.NewInstanceTemplatePrototypeInstanceTemplateByImage(image, primaryNetworkInterface, zone) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot successfully`, func() { - var bootVolumeAttachment *vpcv1.VolumeAttachmentPrototypeInstanceBySourceSnapshotContext = nil - var primaryNetworkInterface *vpcv1.NetworkInterfacePrototype = nil - var zone vpcv1.ZoneIdentityIntf = nil - _, err := vpcService.NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot(bootVolumeAttachment, primaryNetworkInterface, zone) - Expect(err).ToNot(BeNil()) - }) It(`Invoke NewInstanceTemplatePrototypeInstanceTemplateBySourceTemplate successfully`, func() { var sourceTemplate vpcv1.InstanceTemplateIdentityIntf = nil _, err := vpcService.NewInstanceTemplatePrototypeInstanceTemplateBySourceTemplate(sourceTemplate) @@ -100894,6 +107095,24 @@ var _ = Describe(`VpcV1`, func() { Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) + It(`Invoke NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN successfully`, func() { + crn := "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9" + _model, err := vpcService.NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9" + _model, err := vpcService.NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID successfully`, func() { + id := "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9" + _model, err := vpcService.NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) It(`Invoke NewEndpointGatewayReservedIPReservedIPIdentityByHref successfully`, func() { href := "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb" _model, err := vpcService.NewEndpointGatewayReservedIPReservedIPIdentityByHref(href) @@ -100944,6 +107163,24 @@ var _ = Describe(`VpcV1`, func() { Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) + It(`Invoke NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN successfully`, func() { + crn := "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9" + _model, err := vpcService.NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9" + _model, err := vpcService.NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID successfully`, func() { + id := "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9" + _model, err := vpcService.NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) It(`Invoke NewFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref successfully`, func() { href := "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e" _model, err := vpcService.NewFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref(href) @@ -100968,6 +107205,24 @@ var _ = Describe(`VpcV1`, func() { Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) + It(`Invoke NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN successfully`, func() { + crn := "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9" + _model, err := vpcService.NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9" + _model, err := vpcService.NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID successfully`, func() { + id := "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9" + _model, err := vpcService.NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) It(`Invoke NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN successfully`, func() { crn := "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a" _model, err := vpcService.NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN(crn) @@ -100986,6 +107241,18 @@ var _ = Describe(`VpcV1`, func() { Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) + It(`Invoke NewFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/instances/5dd61d72-acaa-47c2-a336-3d849660d010/network_attachments/0767-d54eb633-98ea-459d-aa00-6a8e780175a7" + _model, err := vpcService.NewFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID successfully`, func() { + id := "0767-d54eb633-98ea-459d-aa00-6a8e780175a7" + _model, err := vpcService.NewFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) It(`Invoke NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref successfully`, func() { href := "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e" _model, err := vpcService.NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(href) @@ -101034,6 +107301,24 @@ var _ = Describe(`VpcV1`, func() { Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) + It(`Invoke NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN successfully`, func() { + crn := "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9" + _model, err := vpcService.NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9" + _model, err := vpcService.NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID successfully`, func() { + id := "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9" + _model, err := vpcService.NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) It(`Invoke NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref successfully`, func() { href := "https://us-south.iaas.cloud.ibm.com/v1/instance_groups/1e09281b-f177-46fb-baf1-bc152b2e391a/managers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727" _model, err := vpcService.NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref(href) @@ -101046,6 +107331,24 @@ var _ = Describe(`VpcV1`, func() { Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) + It(`Invoke NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN successfully`, func() { + crn := "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9" + _model, err := vpcService.NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9" + _model, err := vpcService.NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID successfully`, func() { + id := "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9" + _model, err := vpcService.NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) It(`Invoke NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN successfully`, func() { crn := "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0" _model, err := vpcService.NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN(crn) @@ -101136,6 +107439,111 @@ var _ = Describe(`VpcV1`, func() { Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) + It(`Invoke NewInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment successfully`, func() { + var catalogOffering vpcv1.InstanceCatalogOfferingPrototypeIntf = nil + var primaryNetworkInterface *vpcv1.NetworkInterfacePrototype = nil + var zone vpcv1.ZoneIdentityIntf = nil + var primaryNetworkAttachment *vpcv1.InstanceNetworkAttachmentPrototype = nil + _, err := vpcService.NewInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment(catalogOffering, primaryNetworkInterface, zone, primaryNetworkAttachment) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface successfully`, func() { + var catalogOffering vpcv1.InstanceCatalogOfferingPrototypeIntf = nil + var zone vpcv1.ZoneIdentityIntf = nil + var primaryNetworkInterface *vpcv1.NetworkInterfacePrototype = nil + _, err := vpcService.NewInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface(catalogOffering, zone, primaryNetworkInterface) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment successfully`, func() { + var image vpcv1.ImageIdentityIntf = nil + var primaryNetworkInterface *vpcv1.NetworkInterfacePrototype = nil + var zone vpcv1.ZoneIdentityIntf = nil + var primaryNetworkAttachment *vpcv1.InstanceNetworkAttachmentPrototype = nil + _, err := vpcService.NewInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment(image, primaryNetworkInterface, zone, primaryNetworkAttachment) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface successfully`, func() { + var image vpcv1.ImageIdentityIntf = nil + var zone vpcv1.ZoneIdentityIntf = nil + var primaryNetworkInterface *vpcv1.NetworkInterfacePrototype = nil + _, err := vpcService.NewInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface(image, zone, primaryNetworkInterface) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment successfully`, func() { + var bootVolumeAttachment *vpcv1.VolumeAttachmentPrototypeInstanceBySourceSnapshotContext = nil + var primaryNetworkInterface *vpcv1.NetworkInterfacePrototype = nil + var zone vpcv1.ZoneIdentityIntf = nil + var primaryNetworkAttachment *vpcv1.InstanceNetworkAttachmentPrototype = nil + _, err := vpcService.NewInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment(bootVolumeAttachment, primaryNetworkInterface, zone, primaryNetworkAttachment) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface successfully`, func() { + var bootVolumeAttachment *vpcv1.VolumeAttachmentPrototypeInstanceBySourceSnapshotContext = nil + var zone vpcv1.ZoneIdentityIntf = nil + var primaryNetworkInterface *vpcv1.NetworkInterfacePrototype = nil + _, err := vpcService.NewInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface(bootVolumeAttachment, zone, primaryNetworkInterface) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment successfully`, func() { + var bootVolumeAttachment *vpcv1.VolumeAttachmentPrototypeInstanceByVolumeContext = nil + var primaryNetworkInterface *vpcv1.NetworkInterfacePrototype = nil + var zone vpcv1.ZoneIdentityIntf = nil + var primaryNetworkAttachment *vpcv1.InstanceNetworkAttachmentPrototype = nil + _, err := vpcService.NewInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment(bootVolumeAttachment, primaryNetworkInterface, zone, primaryNetworkAttachment) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface successfully`, func() { + var bootVolumeAttachment *vpcv1.VolumeAttachmentPrototypeInstanceByVolumeContext = nil + var zone vpcv1.ZoneIdentityIntf = nil + var primaryNetworkInterface *vpcv1.NetworkInterfacePrototype = nil + _, err := vpcService.NewInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface(bootVolumeAttachment, zone, primaryNetworkInterface) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment successfully`, func() { + var catalogOffering vpcv1.InstanceCatalogOfferingPrototypeIntf = nil + var primaryNetworkInterface *vpcv1.NetworkInterfacePrototype = nil + var zone vpcv1.ZoneIdentityIntf = nil + var primaryNetworkAttachment *vpcv1.InstanceNetworkAttachmentPrototype = nil + _, err := vpcService.NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment(catalogOffering, primaryNetworkInterface, zone, primaryNetworkAttachment) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface successfully`, func() { + var catalogOffering vpcv1.InstanceCatalogOfferingPrototypeIntf = nil + var zone vpcv1.ZoneIdentityIntf = nil + var primaryNetworkInterface *vpcv1.NetworkInterfacePrototype = nil + _, err := vpcService.NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface(catalogOffering, zone, primaryNetworkInterface) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment successfully`, func() { + var image vpcv1.ImageIdentityIntf = nil + var primaryNetworkInterface *vpcv1.NetworkInterfacePrototype = nil + var zone vpcv1.ZoneIdentityIntf = nil + var primaryNetworkAttachment *vpcv1.InstanceNetworkAttachmentPrototype = nil + _, err := vpcService.NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment(image, primaryNetworkInterface, zone, primaryNetworkAttachment) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface successfully`, func() { + var image vpcv1.ImageIdentityIntf = nil + var zone vpcv1.ZoneIdentityIntf = nil + var primaryNetworkInterface *vpcv1.NetworkInterfacePrototype = nil + _, err := vpcService.NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface(image, zone, primaryNetworkInterface) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment successfully`, func() { + var bootVolumeAttachment *vpcv1.VolumeAttachmentPrototypeInstanceBySourceSnapshotContext = nil + var primaryNetworkInterface *vpcv1.NetworkInterfacePrototype = nil + var zone vpcv1.ZoneIdentityIntf = nil + var primaryNetworkAttachment *vpcv1.InstanceNetworkAttachmentPrototype = nil + _, err := vpcService.NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment(bootVolumeAttachment, primaryNetworkInterface, zone, primaryNetworkAttachment) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface successfully`, func() { + var bootVolumeAttachment *vpcv1.VolumeAttachmentPrototypeInstanceBySourceSnapshotContext = nil + var zone vpcv1.ZoneIdentityIntf = nil + var primaryNetworkInterface *vpcv1.NetworkInterfacePrototype = nil + _, err := vpcService.NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface(bootVolumeAttachment, zone, primaryNetworkInterface) + Expect(err).ToNot(BeNil()) + }) It(`Invoke NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref successfully`, func() { href := "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004" _model, err := vpcService.NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(href) @@ -101232,6 +107640,24 @@ var _ = Describe(`VpcV1`, func() { Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) + It(`Invoke NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN successfully`, func() { + crn := "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9" + _model, err := vpcService.NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9" + _model, err := vpcService.NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID successfully`, func() { + id := "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9" + _model, err := vpcService.NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) It(`Invoke NewRouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP successfully`, func() { address := "0.0.0.0" _model, err := vpcService.NewRouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP(address) @@ -101316,6 +107742,36 @@ var _ = Describe(`VpcV1`, func() { Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) + It(`Invoke NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN successfully`, func() { + crn := "crn:v1:bluemix:public:is:us-south-1:a/123456::virtual-network-interface:0767-fa41aecb-4f21-423d-8082-630bfba1e1d9" + _model, err := vpcService.NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/virtual_network_interfaces/0767-fa41aecb-4f21-423d-8082-630bfba1e1d9" + _model, err := vpcService.NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID successfully`, func() { + id := "0767-fa41aecb-4f21-423d-8082-630bfba1e1d9" + _model, err := vpcService.NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb" + _model, err := vpcService.NewVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID successfully`, func() { + id := "6d353a0f-aeb1-4ae1-832e-1110d10981bb" + _model, err := vpcService.NewVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) It(`Invoke NewVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref successfully`, func() { href := "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb" _model, err := vpcService.NewVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref(href)